mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-12 11:36:35 +00:00
iio: mma8452: fix probe fail when device tree compatible is used.
Correct the logic for the probe. First check of_match_table, if
not meet, then check i2c_driver.id_table. If both not meet, then
return fail.
Fixes: a47ac019e7
("iio: mma8452: Fix probe failing when an i2c_device_id is used")
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://lore.kernel.org/r/1650876060-17577-1-git-send-email-haibo.chen@nxp.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
57ae8a4921
commit
fe18894930
1 changed files with 7 additions and 5 deletions
|
@ -1556,11 +1556,13 @@ static int mma8452_probe(struct i2c_client *client,
|
||||||
mutex_init(&data->lock);
|
mutex_init(&data->lock);
|
||||||
|
|
||||||
data->chip_info = device_get_match_data(&client->dev);
|
data->chip_info = device_get_match_data(&client->dev);
|
||||||
if (!data->chip_info && id) {
|
if (!data->chip_info) {
|
||||||
data->chip_info = &mma_chip_info_table[id->driver_data];
|
if (id) {
|
||||||
} else {
|
data->chip_info = &mma_chip_info_table[id->driver_data];
|
||||||
dev_err(&client->dev, "unknown device model\n");
|
} else {
|
||||||
return -ENODEV;
|
dev_err(&client->dev, "unknown device model\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = iio_read_mount_matrix(&client->dev, &data->orientation);
|
ret = iio_read_mount_matrix(&client->dev, &data->orientation);
|
||||||
|
|
Loading…
Reference in a new issue