iio: imu: inv_icm45600: Add a missing return statement in probe()
Subsystems (3)
PATCH 1/1 iio: imu: inv_icm45600: Add a missing return statement in probe()
The intention here was clearly to return -ENODEV but the return statement was missing. It would result in an off by one read in i3c_chip_info[] on the next line. Add the return statement.
--- drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c +2 -1
@@ -57,7 +57,8 @@ static int inv_icm45600_i3c_probe(struct i3c_device *i3cdev) }if (chip == nb_chip) -dev_err_probe (&i3cdev->dev, -ENODEV ,"Failed to match part id %d\n" , whoami); +return dev_err_probe (&i3cdev->dev, -ENODEV , +"Failed to match part id %d\n" , whoami);return inv_icm45600_core_probe (regmap, i3c_chip_info[chip], false,NULL ); }
Signature · 1 line
2.51.0
Quoted 7 lines · Dan Carpenter
The intention here was clearly to return
-ENODEVbut the return statement was missing. It would result in an off by one read in i3c_chip_info[] on the next line. Add the return statement.Fixes 1bef24e9007e ("iio: imu: inv_icm45600: add I3C driver for inv_icm45600 driver")Signed-off-by Dan Carpenter <[email protected]>---
Jonathan Cameron
maintainerQuoted 15 lines · On Wed, 22 Oct 2025 14:02:20 +0300 Dan Carpenter <[email protected]>…
The intention here was clearly to return
-ENODEVbut the return statement was missing. It would result in an off by one read in i3c_chip_info[] on the next line. Add the return statement.Fixes 1bef24e9007e ("iio: imu: inv_icm45600: add I3C driver for inv_icm45600 driver")Signed-off-by Dan Carpenter <[email protected]>--- drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c +0
-0
drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c static int inv_icm45600_i3c_probe(struct i3c_device *i3cdev) · line 64
Quoted 9 lines
drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c +2
-1@@ -57,7 +57,8 @@ static int inv_icm45600_i3c_probe(struct i3c_device *i3cdev) }if (chip == nb_chip) -dev_err_probe (&i3cdev->dev, -ENODEV ,"Failed to match part id %d\n" , whoami); +return dev_err_probe (&i3cdev->dev, -ENODEV , +"Failed to match part id %d\n" , whoami);return inv_icm45600_core_probe (regmap, i3c_chip_info[chip], false,NULL ); }
I'm going to apply this but the resulting code is still wrong (even if not a true bug after this fix).
A hard ID match like this breaks use of dt fallback compatibles.
What this should do is 'give it a go' on matching, but if there no match it should carry on as if the match was to whatever the compatible that was supplied was. When that happens a dev_info() is appropriate but not error out as this does.
Remi, if possible could you look at adding such a patch on top of this?
Thanks,
Jonathan
Remi Buisson
maintainerQuoted 45 lines
From: Jonathan Cameron <[email protected]>
Sent: Monday, October 27, 2025 3:24 PM
To: Dan Carpenter <[email protected]>
Cc: Remi Buisson <[email protected]>; David Lechner <[email protected]>; Nuno Sá <[email protected]>; Andy Shevchenko <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH next] iio: imu:inv_icm45600: Add a missing return statement inprobe()On Wed, 22 Oct 2025 14: 02: 20 +0300 Dan Carpenter <dan. carpenter@ linaro. org> wrote: > The intention here was clearly to return
-ENODEVbut the return statement > was missing. It would result in an off by one read in i3c_chip_info[]Quoted 15 lines · On Wed, 22 Oct 2025 14:02:20 +0300 Dan Carpenter <[email protected]>…
The intention here was clearly to return
-ENODEVbut the return statement was missing. It would result in an off by one read in i3c_chip_info[] on the next line. Add the return statement.Fixes 1bef24e9007e ("iio: imu: inv_icm45600: add I3C driver for inv_icm45600 driver")Signed-off-by Dan Carpenter <[email protected]>--- drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c +0
-0drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c static int inv_icm45600_i3c_probe(struct i3c_device *i3cdev) · line 64
Quoted 9 lines
drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c +2
-1@@ -57,7 +57,8 @@ static int inv_icm45600_i3c_probe(struct i3c_device *i3cdev) }if (chip == nb_chip) -dev_err_probe (&i3cdev->dev, -ENODEV ,"Failed to match part id %d\n" , whoami); +return dev_err_probe (&i3cdev->dev, -ENODEV , +"Failed to match part id %d\n" , whoami);return inv_icm45600_core_probe (regmap, i3c_chip_info[chip], false,NULL ); }I'm going to apply this but the resulting code is still wrong (even if not a true bug after this fix).
A hard ID match like this breaks use of dt fallback compatibles.
What this should do is 'give it a go' on matching, but if there no match it should carry on as if the match was to whatever the compatible that was supplied was. When that happens adev_info()is appropriate but not error out as this does.
Quoted 6 lines
Remi, if possible could you look at adding such a patch on top of this?
Thanks,
Jonathan
Thanks Jonathan, the fix is correct.
The problem is that I3C don't specify any device in the device tree,
and these sensors cannot be identified by their I3C IDs neither.
So, the driver cannot fallbacks to any compatible device, other than picking one, more or less, at random. Do you see any way to work around this limitation?
Jonathan Cameron
maintainerQuoted 49 lines · On Fri, 31 Oct 2025 09:56:45 +0000 Remi Buisson <[email protected]> wrote:
Quoted 49 lines
From: Jonathan Cameron <[email protected]>
Sent: Monday, October 27, 2025 3:24 PM
To: Dan Carpenter <[email protected]>
Cc: Remi Buisson <[email protected]>; David Lechner <[email protected]>; Nuno Sá <[email protected]>; Andy Shevchenko <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH next] iio: imu:inv_icm45600: Add a missing return statement inprobe()On Wed, 22 Oct 2025 14: 02: 20 +0300 Dan Carpenter <dan. carpenter@ linaro. org> wrote: > The intention here was clearly to return
-ENODEVbut the return statement > was missing. It would result in an off by one read in i3c_chip_info[]Quoted 15 lines · On Wed, 22 Oct 2025 14:02:20 +0300 Dan Carpenter <[email protected]>…
The intention here was clearly to return
-ENODEVbut the return statement was missing. It would result in an off by one read in i3c_chip_info[] on the next line. Add the return statement.Fixes 1bef24e9007e ("iio: imu: inv_icm45600: add I3C driver for inv_icm45600 driver")Signed-off-by Dan Carpenter <[email protected]>--- drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c +0
-0drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c static int inv_icm45600_i3c_probe(struct i3c_device *i3cdev) · line 64
Quoted 9 lines
drivers/iio/imu/inv_icm45600/inv_icm45600_i3c.c +2
-1@@ -57,7 +57,8 @@ static int inv_icm45600_i3c_probe(struct i3c_device *i3cdev) }if (chip == nb_chip) -dev_err_probe (&i3cdev->dev, -ENODEV ,"Failed to match part id %d\n" , whoami); +return dev_err_probe (&i3cdev->dev, -ENODEV , +"Failed to match part id %d\n" , whoami);return inv_icm45600_core_probe (regmap, i3c_chip_info[chip], false,NULL ); }I'm going to apply this but the resulting code is still wrong (even if not a true bug after this fix).
A hard ID match like this breaks use of dt fallback compatibles.
What this should do is 'give it a go' on matching, but if there no match it should carry on as if the match was to whatever the compatible that was supplied was. When that happens adev_info()is appropriate but not error out as this does.Remi, if possible could you look at adding such a patch on top of this?
Thanks,
Quoted 7 lines
Quoted 2 lines
Jonathan
Thanks Jonathan, the fix is correct.
The problem is that I3C don't specify any device in the device tree,
and these sensors cannot be identified by their I3C IDs neither.
So, the driver cannot fallbacks to any compatible device, other than picking one, more or less, at random. Do you see any way to work around this limitation?
Ah. I'd missed that. Fair enough, sounds like nothing we can do if the driver doesn't know the ID.
Jonathan