[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b6f1c7c1-9fd6-43fe-b7b0-5d4a5fc532d6@lunn.ch>
Date: Sat, 29 Jun 2024 00:23:47 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Sagar Cheluvegowda <quic_scheluve@...cinc.com>
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
> > 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
Powered by blists - more mailing lists