Re: [PATCH v2 2/3] net: stmmac: Add interconnect support

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

 




On 6/28/2024 3:23 PM, Andrew Lunn wrote:
>>> Sorry, PTR_ERR().
>>>
>>> In general, a cast to a void * is a red flag and will get looked
>>> at. It is generally wrong. So you might want to fixup where ever you
>>> copied this from.
>>>
>>> 	Andrew
> 
>> the return type of stmmac_probe_config_dt is a pointer of type plat_stmmacenet_data,
>> as PTR_ERR would give long integer value i don't think it would be ideal to
>> return an integer value here, if casting plat->axi_icc_path to a void * doesn't look
>> good, let me if the below solution is better or not?
> 
>>  	plat->axi_icc_path = devm_of_icc_get(&pdev->dev, "axi");
>> 	if (IS_ERR(plat->axi_icc_path)) {
>> 		rc = PTR_ERR(plat->axi_icc_path);
>> 		ret = ERR_PTR(rc);
> 
> Don't you think this looks ugly?
> 
> If it looks ugly, it is probably wrong. You cannot be the first person
> to find the return type of an error is wrong. So a quick bit of
> searching found ERR_CAST().
> 
> 	Andrew
Thanks Andrew, using ERR_CAST would be ideal here.




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux