Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2053036pxj; Sun, 9 May 2021 13:44:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznZErR0FZy3Fureli6XLNSSPRDYoaEOl9M624wEZj2fD5zUi9+qVOEolTrwhCox0Lyd8r0 X-Received: by 2002:a05:6402:1547:: with SMTP id p7mr25767327edx.319.1620593069882; Sun, 09 May 2021 13:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620593069; cv=none; d=google.com; s=arc-20160816; b=Ssydn6GcJocoIrsgd2j8pk+FQfn1SQwF7OOvkmThtnudiDGMtIA/dKkt5a39mmOU1t a4SJHoWaFbWMo+Gt3/hVfVYDSKh3M4uG6UuhIzORAtxAI/GXBGi9zCdzoURZOeFlEp1k eN5sZIqWSNiZJQWuO89zMG7DSwXJYzDYiZ9VLt0P6keBTzcqMoDZMD/80E+GmsotUEuf aaOXOZUZIAZA8OPv71DdPsV+xiUBW5CdJxlLQI0cp+plC55EYV7qpCR0qAc31eTFVEFG +O4YFE/JeQO2JePFfPwjn9ejoPRsrmD2oiLCJQISaAO6m2MgHgRkCRtwbROIOUWCkR5H 0Jsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=H44KSAQwEApptfzhqhwrRgt5HK39nW5JfvC5QEs8LEs=; b=Gb30bh5O3jG0xi16NboEmkUzst7rGvy90YJ2vnrsg1IRggOzEtE88Ce0DDjeMB5F40 sR8AYdNJ2tsQtFBZ2apgbkNCAkQ3QpdAUNW/7fx4CY0ZAWPQP+S871nTwX1mZBdgJXsP OQDkH4Ldstar1h22b0pe/GwtzEUuIN/OkbhXNqAIsktASTPd434IBwJRxMWONyEcU7jB Zw9tiYSFtG+YWdFyW9cvl1f69V3CpBBd09nAu7GtvIvL/WWgMzJ1HD2aDOR+LrBM9vjs I8dIMWqSHptXDNdbpO4DcoYCQfmE2CwBu7EEmdUb5quibwZ5mcatC1aqOgnsGX2BIQd0 q+wg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y23si11757740edu.555.2021.05.09.13.43.43; Sun, 09 May 2021 13:44:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbhEIUkh (ORCPT + 99 others); Sun, 9 May 2021 16:40:37 -0400 Received: from smtprelay0166.hostedemail.com ([216.40.44.166]:50410 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229840AbhEIUkh (ORCPT ); Sun, 9 May 2021 16:40:37 -0400 Received: from omf10.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id C72281803EB48; Sun, 9 May 2021 20:39:32 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf10.hostedemail.com (Postfix) with ESMTPA id 716322351F4; Sun, 9 May 2021 20:39:31 +0000 (UTC) Message-ID: <26e1929386babea33d4a320b506c5247caacde77.camel@perches.com> Subject: Re: [PATCH] HID: ft260: fix format type warning in ft260_word_show() From: Joe Perches To: Michael Zaidman , lkp@intel.com Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org, jikos@kernel.org, dan.carpenter@oracle.com, linux-input@vger.kernel.org Date: Sun, 09 May 2021 13:39:29 -0700 In-Reply-To: <20210509193213.5974-1-michael.zaidman@gmail.com> References: <202105060637.LeEC6ztp-lkp@intel.com> <20210509193213.5974-1-michael.zaidman@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 716322351F4 X-Spam-Status: No, score=-1.39 X-Stat-Signature: ej3kn3hz1a616w4iphgdqbkydg44xq9z X-Rspamd-Server: rspamout01 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX18+mGqGafvpLnySgOkl4ipBmKaijyWq5nc= X-HE-Tag: 1620592771-976842 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2021-05-09 at 22:32 +0300, Michael Zaidman wrote: > Fixes: 6a82582d9fa4 ("HID: ft260: add usb hid to i2c host bridge driver") > > Fix warning reported by static analysis when built with W=1 for arm64 by > clang version 13.0.0 > > > > drivers/hid/hid-ft260.c:794:44: warning: format specifies type 'short' but > ???the argument has type 'int' [-Wformat] > ???????????return scnprintf(buf, PAGE_SIZE, "%hi\n", le16_to_cpu(*field)); > ?????????????????????????????????????????????~~~ ^~~~~~~~~~~~~~~~~~~ > ?????????????????????????????????????????????%i > ???include/linux/byteorder/generic.h:91:21: note: expanded from > ????????????????????????????????????????????macro 'le16_to_cpu' > ???#define le16_to_cpu __le16_to_cpu > ???????????????????????^ > ???include/uapi/linux/byteorder/big_endian.h:36:26: note: expanded from > ????????????????????????????????????????????????????macro '__le16_to_cpu' > ???#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) > ????????????????????????????^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ???include/uapi/linux/swab.h:105:2: note: expanded from macro '__swab16' > ???????????(__builtin_constant_p((__u16)(x)) ? \ > ???????????^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Signed-off-by: Michael Zaidman > Reported-by: kernel test robot > --- > ?drivers/hid/hid-ft260.c | 2 +- > ?1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c > index 047aa85a7c83..38794a29599c 100644 > --- a/drivers/hid/hid-ft260.c > +++ b/drivers/hid/hid-ft260.c > @@ -791,7 +791,7 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len, > ? if (ret != len && ret >= 0) > ? return -EIO; > ? > > - return scnprintf(buf, PAGE_SIZE, "%hi\n", le16_to_cpu(*field)); > + return scnprintf(buf, PAGE_SIZE, "%d\n", le16_to_cpu(*field)); > ?} There are 2 of these so I wonder about the static analysis. It's probably better to use sysfs_emit as well. --- drivers/hid/hid-ft260.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 7a9ba984a75a..475641682fff 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -783,7 +783,7 @@ static int ft260_byte_show(struct hid_device *hdev, int id, u8 *cfg, int len, if (ret != len && ret >= 0) return -EIO; - return scnprintf(buf, PAGE_SIZE, "%hi\n", *field); + return sysfs_emit(buf, "%d\n", *field); } static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len, @@ -795,7 +795,7 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len, if (ret != len && ret >= 0) return -EIO; - return scnprintf(buf, PAGE_SIZE, "%hi\n", le16_to_cpu(*field)); + return sysfs_emit(buf, "%d\n", le16_to_cpu(*field)); } #define FT260_ATTR_SHOW(name, reptype, id, type, func) \