From patchwork Sun Apr 23 09:26:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 97968 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1005647qgf; Sun, 23 Apr 2017 02:30:30 -0700 (PDT) X-Received: by 10.98.195.10 with SMTP id v10mr19554195pfg.219.1492939830065; Sun, 23 Apr 2017 02:30:30 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 189si15337571pgb.323.2017.04.23.02.30.29; Sun, 23 Apr 2017 02:30:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1044384AbdDWJa2 (ORCPT + 7 others); Sun, 23 Apr 2017 05:30:28 -0400 Received: from foss.arm.com ([217.140.101.70]:47086 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1044436AbdDWJ1d (ORCPT ); Sun, 23 Apr 2017 05:27:33 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F0707174E; Sun, 23 Apr 2017 02:27:32 -0700 (PDT) Received: from gby.kfn.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C3CF53F220; Sun, 23 Apr 2017 02:27:28 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" , Rob Herring , Mark Rutland , Greg Kroah-Hartman , devel@driverdev.osuosl.org Cc: linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, gilad.benyossef@arm.com, Binoy Jayan , Ofir Drang , Stuart Yoder , Stephan Muller , kbuild test robot , Fengguang Wu Subject: [PATCH v3 13/15] staging: ccree: fix array_size.cocci warnings Date: Sun, 23 Apr 2017 12:26:21 +0300 Message-Id: <1492939583-25688-14-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1492939583-25688-1-git-send-email-gilad@benyossef.com> References: <1492939583-25688-1-git-send-email-gilad@benyossef.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: kbuild test robot drivers/staging/ccree/ssi_sysfs.c:319:34-35: WARNING: Use ARRAY_SIZE drivers/staging/ccree/ssi_sysfs.c:429:34-35: WARNING: Use ARRAY_SIZE Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element Semantic patch information: This makes an effort to find cases where ARRAY_SIZE can be used such as where there is a division of sizeof the array by the sizeof its first element or by any indexed element or the element type. It replaces the division of the two sizeofs by ARRAY_SIZE. Generated by: scripts/coccinelle/misc/array_size.cocci Signed-off-by: Gilad Ben-Yossef Signed-off-by: Fengguang Wu --- drivers/staging/ccree/ssi_sysfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" 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/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 6db7573..7c514c1 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -316,7 +316,7 @@ static ssize_t ssi_sys_help_show(struct kobject *kobj, int i=0, offset = 0; offset += scnprintf(buf + offset, PAGE_SIZE - offset, "Usage:\n"); - for ( i = 0; i < (sizeof(help_str)/sizeof(help_str[0])); i+=2) { + for ( i = 0; i < ARRAY_SIZE(help_str); i+=2) { offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s\t\t%s\n", help_str[i], help_str[i+1]); } return offset; @@ -426,8 +426,7 @@ int ssi_sysfs_init(struct kobject *sys_dev_obj, struct ssi_drvdata *drvdata) /* Initialize top directory */ retval = sys_init_dir(&sys_top_dir, drvdata, sys_dev_obj, "cc_info", ssi_sys_top_level_attrs, - sizeof(ssi_sys_top_level_attrs) / - sizeof(struct kobj_attribute)); + ARRAY_SIZE(ssi_sys_top_level_attrs)); return retval; }