* [PATCH] i2c: muxes: Fix return value check in mule_i2c_mux_probe()
@ 2024-10-26 3:09 Yang Yingliang
2024-10-31 12:09 ` Andi Shyti
0 siblings, 1 reply; 4+ messages in thread
From: Yang Yingliang @ 2024-10-26 3:09 UTC (permalink / raw)
To: peda, farouk.bouabid, andi.shyti, wsa+renesas
Cc: linux-i2c, yangyingliang, bobo.shaobowang
From: Yang Yingliang <yangyingliang@huawei.com>
If dev_get_regmap() fails, it returns NULL pointer not ERR_PTR(),
replace IS_ERR() with NULL pointer check, and return -ENODEV.
Fixes: d0f8e97866bf ("i2c: muxes: add support for tsd,mule-i2c multiplexer")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/i2c/muxes/i2c-mux-mule.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/muxes/i2c-mux-mule.c b/drivers/i2c/muxes/i2c-mux-mule.c
index 8e942470b35f..284ff4afeeac 100644
--- a/drivers/i2c/muxes/i2c-mux-mule.c
+++ b/drivers/i2c/muxes/i2c-mux-mule.c
@@ -66,8 +66,8 @@ static int mule_i2c_mux_probe(struct platform_device *pdev)
priv = i2c_mux_priv(muxc);
priv->regmap = dev_get_regmap(mux_dev->parent, NULL);
- if (IS_ERR(priv->regmap))
- return dev_err_probe(mux_dev, PTR_ERR(priv->regmap),
+ if (!priv->regmap)
+ return dev_err_probe(mux_dev, -ENODEV,
"No parent i2c register map\n");
platform_set_drvdata(pdev, muxc);
--
2.33.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] i2c: muxes: Fix return value check in mule_i2c_mux_probe()
2024-10-26 3:09 [PATCH] i2c: muxes: Fix return value check in mule_i2c_mux_probe() Yang Yingliang
@ 2024-10-31 12:09 ` Andi Shyti
2024-11-04 10:56 ` Wolfram Sang
0 siblings, 1 reply; 4+ messages in thread
From: Andi Shyti @ 2024-10-31 12:09 UTC (permalink / raw)
To: Yang Yingliang
Cc: peda, farouk.bouabid, wsa+renesas, linux-i2c, yangyingliang,
bobo.shaobowang
Hi Yang,
On Sat, Oct 26, 2024 at 11:09:42AM +0800, Yang Yingliang wrote:
> From: Yang Yingliang <yangyingliang@huawei.com>
>
> If dev_get_regmap() fails, it returns NULL pointer not ERR_PTR(),
> replace IS_ERR() with NULL pointer check, and return -ENODEV.
>
> Fixes: d0f8e97866bf ("i2c: muxes: add support for tsd,mule-i2c multiplexer")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
merged to i2c/i2c-host-fixes.
Thanks,
Andi
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] i2c: muxes: Fix return value check in mule_i2c_mux_probe()
2024-10-31 12:09 ` Andi Shyti
@ 2024-11-04 10:56 ` Wolfram Sang
2024-11-04 12:55 ` Farouk Bouabid
0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2024-11-04 10:56 UTC (permalink / raw)
To: Andi Shyti
Cc: Yang Yingliang, peda, farouk.bouabid, linux-i2c, yangyingliang,
bobo.shaobowang
[-- Attachment #1: Type: text/plain, Size: 813 bytes --]
On Thu, Oct 31, 2024 at 01:09:17PM +0100, Andi Shyti wrote:
> Hi Yang,
>
> On Sat, Oct 26, 2024 at 11:09:42AM +0800, Yang Yingliang wrote:
> > From: Yang Yingliang <yangyingliang@huawei.com>
> >
> > If dev_get_regmap() fails, it returns NULL pointer not ERR_PTR(),
> > replace IS_ERR() with NULL pointer check, and return -ENODEV.
> >
> > Fixes: d0f8e97866bf ("i2c: muxes: add support for tsd,mule-i2c multiplexer")
> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>
> merged to i2c/i2c-host-fixes.
I'd like an ack from Farouk here. In general, -ENODEV makes the driver
core sliently fail (ok, we have a printout but still). But not getting
the regmap sounds like a real error to me. I'd suggest -ENOENT or
something. But maybe this mux is a special case, Farouk should know.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] i2c: muxes: Fix return value check in mule_i2c_mux_probe()
2024-11-04 10:56 ` Wolfram Sang
@ 2024-11-04 12:55 ` Farouk Bouabid
0 siblings, 0 replies; 4+ messages in thread
From: Farouk Bouabid @ 2024-11-04 12:55 UTC (permalink / raw)
To: Wolfram Sang, Andi Shyti, Yang Yingliang, peda, linux-i2c,
yangyingliang, bobo.shaobowang
Hi,
On 04.11.24 11:56, Wolfram Sang wrote:
> On Thu, Oct 31, 2024 at 01:09:17PM +0100, Andi Shyti wrote:
>> Hi Yang,
>>
>> On Sat, Oct 26, 2024 at 11:09:42AM +0800, Yang Yingliang wrote:
>>> From: Yang Yingliang <yangyingliang@huawei.com>
>>>
>>> If dev_get_regmap() fails, it returns NULL pointer not ERR_PTR(),
>>> replace IS_ERR() with NULL pointer check, and return -ENODEV.
>>>
>>> Fixes: d0f8e97866bf ("i2c: muxes: add support for tsd,mule-i2c multiplexer")
>>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> merged to i2c/i2c-host-fixes.
> I'd like an ack from Farouk here. In general, -ENODEV makes the driver
> core sliently fail (ok, we have a printout but still). But not getting
> the regmap sounds like a real error to me. I'd suggest -ENOENT or
> something. But maybe this mux is a special case, Farouk should know.
>
I think the -ENODEV is good enough since we already log the error.
Thanks
Best regards
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-04 12:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-26 3:09 [PATCH] i2c: muxes: Fix return value check in mule_i2c_mux_probe() Yang Yingliang
2024-10-31 12:09 ` Andi Shyti
2024-11-04 10:56 ` Wolfram Sang
2024-11-04 12:55 ` Farouk Bouabid
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox