From patchwork Tue Aug 14 06:51:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 1318391 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B5FA53FC81 for ; Tue, 14 Aug 2012 06:52:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752231Ab2HNGv5 (ORCPT ); Tue, 14 Aug 2012 02:51:57 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]:48379 "EHLO rcsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751131Ab2HNGv4 (ORCPT ); Tue, 14 Aug 2012 02:51:56 -0400 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q7E6pRZT031321 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 14 Aug 2012 06:51:28 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q7E6pRTh013095 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 14 Aug 2012 06:51:27 GMT Received: from abhmt110.oracle.com (abhmt110.oracle.com [141.146.116.62]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q7E6pQS3020071; Tue, 14 Aug 2012 01:51:26 -0500 Received: from elgon.mountain (/41.212.103.53) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 13 Aug 2012 23:51:26 -0700 Date: Tue, 14 Aug 2012 09:51:20 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Malcolm Priestley , Hans Verkuil , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] [media] it913x-fe: use ARRAY_SIZE() as a cleanup Message-ID: <20120814065120.GA4791@elgon.mountain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: ucsinet22.oracle.com [156.151.31.94] Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;