Re: [PATCH net v2] net: ethernet: ti: am65-cpsw: Fix devlink port register sequence
From: Siddharth Vadapalli
Date: Wed Jul 06 2022 - 01:00:27 EST
Hello Jakub,
On 06/07/22 07:09, Jakub Kicinski wrote:
> On Mon, 4 Jul 2022 13:00:40 +0530 Siddharth Vadapalli wrote:
>> @@ -2527,6 +2527,10 @@ static int am65_cpsw_nuss_register_ndevs(struct am65_cpsw_common *common)
>> return ret;
>> }
>>
>> + ret = am65_cpsw_nuss_register_devlink(common);
>> + if (ret)
>> + goto err_cleanup_ndev;
>> +
>> for (i = 0; i < common->port_num; i++) {
>> port = &common->ports[i];
>>
>> @@ -2539,23 +2543,21 @@ static int am65_cpsw_nuss_register_ndevs(struct am65_cpsw_common *common)
>> i, ret);
>> goto err_cleanup_ndev;
>> }
>> +
>> + dl_port = &port->devlink_port;
>> + devlink_port_type_eth_set(dl_port, port->ndev);
>> }
>>
>> ret = am65_cpsw_register_notifiers(common);
>> if (ret)
>> goto err_cleanup_ndev;
>>
>> - ret = am65_cpsw_nuss_register_devlink(common);
>> - if (ret)
>> - goto clean_unregister_notifiers;
>> -
>> /* can't auto unregister ndev using devm_add_action() due to
>> * devres release sequence in DD core for DMA
>> */
>>
>> return 0;
>> -clean_unregister_notifiers:
>> - am65_cpsw_unregister_notifiers(common);
>> +
>> err_cleanup_ndev:
>> am65_cpsw_nuss_cleanup_ndev(common);
>
> No additions to the error handling path? Slightly suspicious.
> Do the devlink ports not have to be removed if netdev registration
> fails?
Thank you for pointing it out. I had missed adding the cleanup for the register
devlink function call. I will add it and post the v3 patch.
Regards,
Siddharth.