[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <23bc7c20-f736-a8fb-b89c-c9039380e55b@redhat.com>
Date: Mon, 31 Aug 2020 11:11:57 -0700
From: Tom Rix <trix@...hat.com>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: matrandg@...co.com, Mauro Carvalho Chehab <mchehab@...nel.org>,
Nathan Chancellor <natechancellor@...il.com>,
p.zabel@...gutronix.de, Hans Verkuil <hans.verkuil@...co.com>,
linux-media@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] media: tc358743: initialize variable
On 8/31/20 10:31 AM, Nick Desaulniers wrote:
> On Sun, Aug 30, 2020 at 9:30 AM <trix@...hat.com> wrote:
>> From: Tom Rix <trix@...hat.com>
>>
>> clang static analysis flags this error
>>
>> tc358743.c:1468:9: warning: Branch condition evaluates
>> to a garbage value
>> return handled ? IRQ_HANDLED : IRQ_NONE;
>> ^~~~~~~
>> handled should be initialized to false.
>>
>> Fixes: d747b806abf4 ("[media] tc358743: add direct interrupt handling")
>> Signed-off-by: Tom Rix <trix@...hat.com>
> I'm guessing there was more to the report that says that `handled`
> isn't necessarily initialized along any of the paths within
> tc358743_isr()? But you should fix this for all callers of
> tc358743_isr(), such as tc358743_work_i2c_poll(), not just
> tc358743_irq_handler().
Interesting. The static analyzer did not catch this.
I will take another.
Thanks
Tom
>> ---
>> drivers/media/i2c/tc358743.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
>> index a03dcab5ce61..c724bd1591de 100644
>> --- a/drivers/media/i2c/tc358743.c
>> +++ b/drivers/media/i2c/tc358743.c
>> @@ -1461,7 +1461,7 @@ static int tc358743_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
>> static irqreturn_t tc358743_irq_handler(int irq, void *dev_id)
>> {
>> struct tc358743_state *state = dev_id;
>> - bool handled;
>> + bool handled = false;
>>
>> tc358743_isr(&state->sd, 0, &handled);
>>
>> --
>> 2.18.1
>>
>
Powered by blists - more mailing lists