linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: cx18: Don't check for address of video_dev
@ 2018-09-21 19:57 Nathan Chancellor
  2018-09-21 20:31 ` Nick Desaulniers
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Nathan Chancellor @ 2018-09-21 19:57 UTC (permalink / raw)
  To: Andy Walls, Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel, Nick Desaulniers, Nathan Chancellor

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)
 			cancel_work_sync(&cx->streams[i].out_work_order);
 }
 
-- 
2.19.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-10-01 23:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2018-10-01 15:21 ` [PATCH v2] " Nathan Chancellor
2018-10-01 23:05   ` Nick Desaulniers
2018-10-01 23:12     ` Nathan Chancellor

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).