Re: [PATCH v3 5/7] PCI: xilinx-nwl: Clean up clock on probe failure/removal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/23/24 16:11, Markus Elfring wrote:
>>> …
>>>> +++ b/drivers/pci/controller/pcie-xilinx-nwl.c
>>> …
>>>> @@ -817,11 +818,23 @@ static int nwl_pcie_probe(struct platform_device *pdev)
>>>>  		err = nwl_pcie_enable_msi(pcie);
>>>>  		if (err < 0) {
>>>>  			dev_err(dev, "failed to enable MSI support: %d\n", err);
>>>> -			return err;
>>>> +			goto err_clk;
>>>>  		}
>>>>  	}
>>>>
>>>> -	return pci_host_probe(bridge);
>>>> +	err = pci_host_probe(bridge);
>>>> +
>>>> +err_clk:
>>>> +	if (err)
>>>> +		clk_disable_unprepare(pcie->clk);
>>>
>>> I suggest to use the label “disable_unprepare_clock” directly before this function call
>>> (in the if branch) so that a duplicate check would be avoided after some error cases.
>>
>> Well if you want to avoid a check, we can just do
>>
>> err = pci_host_probe(bridge);
>> if (!err)
>> 	return 0;
>>
>> err_clk:
>> 	...
> 
> This design variant can also be reasonable.
> 
> Do any preferences matter here for label name selections?

Personally, I prefer to use labels named after what they're cleaning up and not what they're doing.

--Sean




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux