All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <natechancellor@gmail.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Andy Walls <awalls@md.metrocast.net>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH] media: cx18: Don't check for address of video_dev
Date: Mon, 1 Oct 2018 08:08:07 -0700	[thread overview]
Message-ID: <20181001150807.GA16790@flashbox> (raw)
In-Reply-To: <440b7ec3-b0b6-c96b-93de-4b6a3be44eac@xs4all.nl>

On Mon, Oct 01, 2018 at 10:30:54AM +0200, Hans Verkuil wrote:
> On 09/21/2018 09:57 PM, Nathan Chancellor wrote:
> > Clang warns that the address of a pointer will always evaluated as true
> > in a boolean context.
> > 
> > drivers/media/pci/cx18/cx18-driver.c:1255:23: warning: address of
> > 'cx->streams[i].video_dev' will always evaluate to 'true'
> > [-Wpointer-bool-conversion]
> >                 if (&cx->streams[i].video_dev)
> >                 ~~   ~~~~~~~~~~~~~~~^~~~~~~~~
> > 1 warning generated.
> > 
> > Presumably, the contents of video_dev should have been checked, not the
> > address. This check has been present since 2009, introduced by commit
> > 21a278b85d3c ("V4L/DVB (11619): cx18: Simplify the work handler for
> > outgoing mailbox commands")
> > 
> > Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> > 
> > Alternatively, this if statement could just be removed since it has
> > evaluated to true since 2009 and I assume some issue with this would
> > have been discovered by now.
> > 
> >  drivers/media/pci/cx18/cx18-driver.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c
> > index 56763c4ea1a7..753a37c7100a 100644
> > --- a/drivers/media/pci/cx18/cx18-driver.c
> > +++ b/drivers/media/pci/cx18/cx18-driver.c
> > @@ -1252,7 +1252,7 @@ static void cx18_cancel_out_work_orders(struct cx18 *cx)
> >  {
> >  	int i;
> >  	for (i = 0; i < CX18_MAX_STREAMS; i++)
> > -		if (&cx->streams[i].video_dev)
> > +		if (cx->streams[i].video_dev)
> 
> This should read:
> 
> 		if (cx->streams[i].video_dev.v4l2_dev)
> 
> If cx->streams[i].video_dev.v4l2_dev == NULL, then the stream is not in use
> and there is no need to cancel any work.
> 
> Can you post a v2?
> 

Hi Hans,

Yes, sorry, I completely forgot to look into this further. I will sent a
v2 right now.

Thank you for the review,
Nathan

> >  			cancel_work_sync(&cx->streams[i].out_work_order);
> >  }
> >  
> > 
> 
> Regards,
> 
> 	Hans

  reply	other threads:[~2018-10-01 21:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-21 19:57 [PATCH] media: cx18: Don't check for address of video_dev Nathan Chancellor
2018-09-21 20:31 ` Nick Desaulniers
2018-09-21 20:40   ` Nathan Chancellor
2018-09-22 11:48 ` kbuild test robot
2018-09-22 12:40 ` kbuild test robot
2018-10-01  8:30 ` Hans Verkuil
2018-10-01 15:08   ` Nathan Chancellor [this message]
2018-10-01 15:21 ` [PATCH v2] " Nathan Chancellor
2018-10-01 23:05   ` Nick Desaulniers
2018-10-01 23:12     ` Nathan Chancellor

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=20181001150807.GA16790@flashbox \
    --to=natechancellor@gmail.com \
    --cc=awalls@md.metrocast.net \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ndesaulniers@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.