Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1591665img; Wed, 27 Feb 2019 01:57:53 -0800 (PST) X-Google-Smtp-Source: AHgI3IZwTV+wU07z3s8EpT1/ws+om4F/IP2u+FFlmnbLJTu2Q+8BM2nbkmA7w78vZztfAfCZrLme X-Received: by 2002:a62:4414:: with SMTP id r20mr784143pfa.37.1551261473916; Wed, 27 Feb 2019 01:57:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551261473; cv=none; d=google.com; s=arc-20160816; b=CFuTxX/NgTGnRi1GjV7oYjP42tUO65GlpQc3zG4R1VxkAGuPK80XluIcozYCcHKTc2 Z7JhOVH/GTU6k7mGPdJMX8jhn/z0U6Oee2hdWk1mOT6mEi3TYECG9Wo20pGLAHuSlEeU f3E5QkZQCYcjnZheihy4QSumzH27xNdDcTEPjbo8khZ35Yo7tIZ7D+H0W+cU0mPaDtJA iprH1JCni9GMmSo0JdDqKamz4tONzfIlmXWxdOhRUAL9XiIJdO46hqOQkWAYI7K2Yrul 1PR088rdDyeRt9eQlp8zRyVs+mJQgnZos15OrVz6+10xQo23vLtr1ZRZ9Jy2zS8uQIE9 MZhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=kAoRLra1XXszsSR0IdCenIw5JzavIH0kwImBz3gWHSI=; b=Ez5kRmdi6UXmcJfK36Xf6fZTUFZPsMCSQ/t5x5UgcQx+wm2ZVJtaz6HBr21pZKwbdC 76fpadJhlHvYFHLiYXI9jeFlA0XT5bgdcWCjS06fx3JDqzJCeclJB94uC56At5YAGG07 L6pduRaZ60W+nc5cQoiqCVXBJZepzdyuGo1Zi4wmfdGa56jqq8QX6NYkXXSOuSM/JuAD fUP/t1PquOIZNszYaoOtLV26mj20Qsnpk5cahptnpAYNx1PQBnTh0O9OKnr6BKCgTDDN hyEZ1r/0k5hhX1if6N5E0uSV7Rjo/1eT5SsTtAw5PFkfzhFETWF6lxnhmXuC8sWy2f6z Pe6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si14689805pfn.285.2019.02.27.01.57.35; Wed, 27 Feb 2019 01:57:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729452AbfB0J5P (ORCPT + 99 others); Wed, 27 Feb 2019 04:57:15 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:46949 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728462AbfB0J5O (ORCPT ); Wed, 27 Feb 2019 04:57:14 -0500 Received: by mail-qt1-f193.google.com with SMTP id z25so18410012qti.13 for ; Wed, 27 Feb 2019 01:57:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kAoRLra1XXszsSR0IdCenIw5JzavIH0kwImBz3gWHSI=; b=ZEPYngV1ITtnlskuQOCHoVtg5L3CGEU1+gi0ifdGXEw1yuNU15LHnTk/lsdkuQpo8F 7Srf8kl+biaZwiQ0mHNkjY9i6vIju0gxDLA/g4FDnCXNQecfXlJ/6Xtvn2A3JgcojwAK ah0xJnNENrN89FQZcCSVqPoQ20oGjPmZxHO/iyale13xgWCCHCskjGPaMBH0gKcrIu0n yIsz/bJe9yqkgz/QE3dZbi2KP5VqyeMdr0nEWCi8ZKdkqUT2j7S5T/MFfjcTr2n7PzGs l+J4JsOdsSrkQI/1CdJuG7WJxeP9fohFY5ZyrnE8bJqbiELElzUFRim7ewd/LNjhxYac Xz3g== X-Gm-Message-State: APjAAAWz0tYlByX7p/C33QcA+ZCqEVYaRjCDQWpr3ZcQHSNRxYh3bvrG 7KdH0NHaVh5zQtjEUWa0VJPSiHdFI/IBV5mWUDHC8Q== X-Received: by 2002:ac8:22d1:: with SMTP id g17mr931744qta.30.1551261433544; Wed, 27 Feb 2019 01:57:13 -0800 (PST) MIME-Version: 1.0 References: <20190226234853.20441-1-louis@kragniz.eu> In-Reply-To: <20190226234853.20441-1-louis@kragniz.eu> From: Benjamin Tissoires Date: Wed, 27 Feb 2019 10:57:02 +0100 Message-ID: Subject: Re: [PATCH] HID: quirks: use correct format chars in dbg_hid To: Louis Taylor Cc: Jiri Kosina , "open list:HID CORE LAYER" , lkml , clang-built-linux@googlegroups.com, ndesaulniers@google.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 27, 2019 at 12:50 AM Louis Taylor wrote: > > When building with -Wformat, clang warns: > > drivers/hid/hid-quirks.c:1075:27: warning: format specifies type > 'unsigned short' but the argument has type '__u32' (aka 'unsigned int') > [-Wformat] > bl_entry->driver_data, bl_entry->vendor, > ^~~~~~~~~~~~~~~~ > ./include/linux/hid.h:1170:48: note: expanded from macro 'dbg_hid' > printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \ > ~~~~~~ ^~~ > drivers/hid/hid-quirks.c:1076:4: warning: format specifies type > 'unsigned short' but the argument has type '__u32' (aka 'unsigned int') > [-Wformat] > bl_entry->product); > ^~~~~~~~~~~~~~~~~ > ./include/linux/hid.h:1170:48: note: expanded from macro 'dbg_hid' > printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \ > ~~~~~~ ^~~ > drivers/hid/hid-quirks.c:1242:12: warning: format specifies type > 'unsigned short' but the argument has type '__u32' (aka 'unsigned int') > [-Wformat] > quirks, hdev->vendor, hdev->product); > ^~~~~~~~~~~~ > ./include/linux/hid.h:1170:48: note: expanded from macro 'dbg_hid' > printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \ > ~~~~~~ ^~~ > drivers/hid/hid-quirks.c:1242:26: warning: format specifies type > 'unsigned short' but the argument has type '__u32' (aka 'unsigned int') > [-Wformat] > quirks, hdev->vendor, hdev->product); > ^~~~~~~~~~~~~ > ./include/linux/hid.h:1170:48: note: expanded from macro 'dbg_hid' > printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \ > ~~~~~~ ^~~ > 4 warnings generated. > > This patch fixes the format strings to use the correct format type for unsigned > ints. > > Link: https://github.com/ClangBuiltLinux/linux/issues/378 > Signed-off-by: Louis Taylor > --- > drivers/hid/hid-quirks.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c > index 94088c0ed68a..b4e49e1b6f4a 100644 > --- a/drivers/hid/hid-quirks.c > +++ b/drivers/hid/hid-quirks.c > @@ -1071,7 +1071,7 @@ static struct hid_device_id *hid_exists_dquirk(const struct hid_device *hdev) > } > > if (bl_entry != NULL) > - dbg_hid("Found dynamic quirk 0x%lx for HID device 0x%hx:0x%hx\n", > + dbg_hid("Found dynamic quirk 0x%lx for HID device 0x%x:0x%x\n", Can you make it %04x instead? The VID/PID are usually 4 hex chars, and without the '04' format, you'll end up having a varying length result, which is not that nice. Cheers, Benjamin > bl_entry->driver_data, bl_entry->vendor, > bl_entry->product); > > @@ -1238,7 +1238,7 @@ static unsigned long hid_gets_squirk(const struct hid_device *hdev) > quirks |= bl_entry->driver_data; > > if (quirks) > - dbg_hid("Found squirk 0x%lx for HID device 0x%hx:0x%hx\n", > + dbg_hid("Found squirk 0x%lx for HID device 0x%x:0x%x\n", > quirks, hdev->vendor, hdev->product); > return quirks; > } > -- > 2.20.1 >