From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Malcolm Priestley <tvboxspy@gmail.com>,
Hans Verkuil <hans.verkuil@cisco.com>,
linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] [media] it913x-fe: use ARRAY_SIZE() as a cleanup
Date: Tue, 14 Aug 2012 06:51:20 +0000 [thread overview]
Message-ID: <20120814065120.GA4791@elgon.mountain> (raw)
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;
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Malcolm Priestley <tvboxspy@gmail.com>,
Hans Verkuil <hans.verkuil@cisco.com>,
linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] [media] it913x-fe: use ARRAY_SIZE() as a cleanup
Date: Tue, 14 Aug 2012 09:51:20 +0300 [thread overview]
Message-ID: <20120814065120.GA4791@elgon.mountain> (raw)
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;
next reply other threads:[~2012-08-14 6:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-14 6:51 Dan Carpenter [this message]
2012-08-14 6:51 ` [patch] [media] it913x-fe: use ARRAY_SIZE() as a cleanup Dan Carpenter
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=20120814065120.GA4791@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=hans.verkuil@cisco.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=tvboxspy@gmail.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.