From: Jonathan Cameron <jic23@kernel.org>
To: haibo.chen@nxp.com
Cc: lars@metafoo.de, hdegoede@redhat.com, linux-iio@vger.kernel.org,
linux-imx@nxp.com
Subject: Re: [PATCH] iio: mma8452: fix probe fail when device tree compatible is used.
Date: Sun, 1 May 2022 17:45:40 +0100 [thread overview]
Message-ID: <20220501174540.17d7a27a@jic23-huawei> (raw)
In-Reply-To: <1650876060-17577-1-git-send-email-haibo.chen@nxp.com>
On Mon, 25 Apr 2022 16:41:00 +0800
haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
>
> 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: a47ac019e7e8 ("iio: mma8452: Fix probe failing when an i2c_device_id is used")
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Yikes.
Just goes to show review doesn't always pick up on the obvious :(
Applied to the fixes-togreg branch of iio.git
Jonathan
> ---
> drivers/iio/accel/mma8452.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 9c02c681c84c..4156d216c640 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1556,11 +1556,13 @@ static int mma8452_probe(struct i2c_client *client,
> mutex_init(&data->lock);
>
> data->chip_info = device_get_match_data(&client->dev);
> - if (!data->chip_info && id) {
> - data->chip_info = &mma_chip_info_table[id->driver_data];
> - } else {
> - dev_err(&client->dev, "unknown device model\n");
> - return -ENODEV;
> + if (!data->chip_info) {
> + if (id) {
> + data->chip_info = &mma_chip_info_table[id->driver_data];
> + } else {
> + dev_err(&client->dev, "unknown device model\n");
> + return -ENODEV;
> + }
> }
>
> ret = iio_read_mount_matrix(&client->dev, &data->orientation);
prev parent reply other threads:[~2022-05-01 16:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 8:41 [PATCH] iio: mma8452: fix probe fail when device tree compatible is used haibo.chen
2022-05-01 16:45 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220501174540.17d7a27a@jic23-huawei \
--to=jic23@kernel.org \
--cc=haibo.chen@nxp.com \
--cc=hdegoede@redhat.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-imx@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).