[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0e148462-4391-470f-b82d-59b07d900f46@quicinc.com>
Date: Fri, 28 Jun 2024 15:41:28 -0700
From: Sagar Cheluvegowda <quic_scheluve@...cinc.com>
To: Andrew Lunn <andrew@...n.ch>
CC: Vinod Koul <vkoul@...nel.org>,
Alexandre Torgue
<alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
"David S.
Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
"Jakub
Kicinski" <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Maxime Coquelin
<mcoquelin.stm32@...il.com>,
Russell King <linux@...linux.org.uk>, "Rob
Herring" <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
"Conor
Dooley" <conor+dt@...nel.org>,
Bhupesh Sharma <bhupesh.sharma@...aro.org>, <kernel@...cinc.com>,
Andrew Halaney <ahalaney@...hat.com>, <linux-arm-msm@...r.kernel.org>,
<netdev@...r.kernel.org>, <linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<devicetree@...r.kernel.org>
Subject: Re: [PATCH v2 2/3] net: stmmac: Add interconnect support
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.
Powered by blists - more mailing lists