Re: [PATCH v6 9/9] iio: accel: mma8452: Use proper error code when missing device model
From: Esben Haabendal
Date: Tue Aug 25 2026 - 07:00:42 EST
"Joshua Crofts" <joshua.crofts1@xxxxxxxxx> writes:
> On Tue, 25 Aug 2026 10:27:47 +0200
> Esben Haabendal <esben@xxxxxxxxxx> wrote:
>
>> The device is there, but we don't have data describing how to use it.
>
> A bit of a weird commit message IMO,
:)
> I'd do
>
> Switch -ENODEV error on i2c_get_match_data() failure to -ENODATA to
> satisfy the IIO coding style. (but this is only my opinion).
Sounds good to me. I will update for next version, if needed. But feel
free to make the change when merging.
/Esben
> (We recently had a few conversations about -ENODEV vs. -ENODATA and
> while there are a lot of uses of -ENODEV in IIO they should be replaced
> with -ENODATA when checking *_get_match_data() results).
>
>>
>> Signed-off-by: Esben Haabendal <esben@xxxxxxxxxx>
>> ---
>> drivers/iio/accel/mma8452.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
>> index 4a1eb196589a..42e3371cdb1d 100644
>> --- a/drivers/iio/accel/mma8452.c
>> +++ b/drivers/iio/accel/mma8452.c
>> @@ -1595,7 +1595,7 @@ static int mma8452_probe(struct i2c_client *client)
>>
>> data->chip_info = i2c_get_match_data(client);
>> if (!data->chip_info)
>> - return dev_err_probe(dev, -ENODEV, "unknown device model\n");
>> + return dev_err_probe(dev, -ENODATA, "unknown device model\n");
>>
>> ret = iio_read_mount_matrix(dev, &data->orientation);
>> if (ret)
>>
>
> Reviewed-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
>
> --
> Kind regards,
> Joshua Crofts