linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] [media] it913x-fe: use ARRAY_SIZE() as a cleanup
@ 2012-08-14  6:51 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2012-08-14  6:51 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Malcolm Priestley, Hans Verkuil, linux-media, kernel-janitors

This code looks suspicious, but it turns out that "nv" is an array of u8
so sizeof() is the same as ARRAY_SIZE().  Using ARRAY_SIZE() is more
readable though.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/media/dvb/frontends/it913x-fe.c b/drivers/media/dvb/frontends/it913x-fe.c
index 708cbf1..6e1c6eb 100644
--- a/drivers/media/dvb/frontends/it913x-fe.c
+++ b/drivers/media/dvb/frontends/it913x-fe.c
@@ -199,7 +199,7 @@ static int it913x_init_tuner(struct it913x_fe_state *state)
 
 	if (reg < 0)
 		return -ENODEV;
-	else if (reg < sizeof(nv))
+	else if (reg < ARRAY_SIZE(nv))
 		nv_val = nv[reg];
 	else
 		nv_val = 2;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-14  6:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-14  6:51 [patch] [media] it913x-fe: use ARRAY_SIZE() as a cleanup Dan Carpenter

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