[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ac2e793b-0f29-ac7b-d29f-3a4695c2eedc@ideasonboard.com>
Date: Mon, 20 Jul 2020 20:04:35 +0100
From: Kieran Bingham <kieran.bingham+renesas@...asonboard.com>
To: Colin King <colin.king@...onical.com>,
Jacopo Mondi <jacopo+renesas@...ndi.org>,
Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
Niklas Söderlund
<niklas.soderlund+renesas@...natech.se>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-media@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] media: i2c: fix error check on max9286_read call
Hi Colin,
On 20/07/2020 17:13, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> Currently the error return from the call to max9286_read is masked
> with 0xf0 so the following check for a negative error return is
> never true. Fix this by checking for an error first, then masking
> the return value for subsequent conflink_mask checking.
Ooops!
> Addresses-Coverity: ("Logically dead code")
> fixes: 66d8c9d2422d ("media: i2c: Add MAX9286 driver")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
Thanks,
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@...asonboard.com>
> ---
> drivers/media/i2c/max9286.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
> index 47f280518fdb..b364a3f60486 100644
> --- a/drivers/media/i2c/max9286.c
> +++ b/drivers/media/i2c/max9286.c
> @@ -405,10 +405,11 @@ static int max9286_check_config_link(struct max9286_priv *priv,
> * to 5 milliseconds.
> */
> for (i = 0; i < 10; i++) {
> - ret = max9286_read(priv, 0x49) & 0xf0;
> + ret = max9286_read(priv, 0x49);
> if (ret < 0)
> return -EIO;
>
> + ret &= 0xf0;
> if (ret == conflink_mask)
> break;
>
>
Powered by blists - more mailing lists