From patchwork Sat Jul 9 00:15:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Stitt X-Patchwork-Id: 12912009 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02299C433EF for ; Sat, 9 Jul 2022 00:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version: Message-Id:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=av1Y2yA6NJgu2juTiIP9WYg1LrDNF8VTMsTcIs23lOo=; b=u9L mKvtsOa+y/prwZMSF4WLCUC3q8VitILxDrYRwuw13HfIH+XWfJz8Irul1YamqIjRv+X9HhgBxLTA6 3rXNXiV7a6QmSG4nKkuFKD0WxTFuvzk/M0GMbzyviKoUznKAV4jIwUiN7CkzO+stQgNdPO0I9/INe boVbvIMcVwnE8PJxl32IoXgu0pP3HLRgb+3qDYG4H9Z1as6uyDYVMjY6S/GXL8q3ZDvg6tN09w8e0 yRXqc45vcfldR18yXcVta8/sbubPHym8g3h91XZ7RLlAxlwipa5dmnXjlx6RBq+vlft5jxhV5H5UB asdf95ZfMhC0hc+2ZenED8+COAo6LwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9y8Q-006RY3-JC; Sat, 09 Jul 2022 00:15:46 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9y8N-006RWL-N9 for linux-arm-kernel@lists.infradead.org; Sat, 09 Jul 2022 00:15:45 +0000 Received: by mail-yb1-xb49.google.com with SMTP id t10-20020a5b07ca000000b0066ec1bb6e2cso126668ybq.14 for ; Fri, 08 Jul 2022 17:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=18zwxTMww86cndEzpYub9pnZe0fDkNY6EnCvkW/t9JY=; b=msxqFvaOZSoAWLO402a9iXoMeeEmvOcEg5VOhX+o22iSw24U+MJ7v5aJbXYhjOXEcs 80KPM4xIH89KOQGhECF+FEZEs0ZImyjKLbt6Mjaj7LDHuEIKn4GysLo5nD9ujirYiRc4 IgHy2nx/83FOn6x/5OM7PPbJlxmw2aA847iuBYirfRbTGllNigutmESrvh5uJ09m2Mkv l1GzyelrnzqNCsFX/zFW/lxNYJkZrXMfA3eK8aHziKCL6C/UMKfsCZEgFvs42zjW7YkW SV0eehnKB7Ka7Mco0HyzgpIJXij9SbnHq6hNPjgtpyS3thEq/3GvRWmlVHpnOUQJW1kd gVqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=18zwxTMww86cndEzpYub9pnZe0fDkNY6EnCvkW/t9JY=; b=lQhfdY53ZTtKAO4c5RXKVbooWYw5Iu3KS1xmU7kwab0oSRmMqfUD/uF8SYYCK1MeFb faRa5LpBAHBeNe4D4LAeyiymMX8/Z/7PSE/LbufAEMH9+hANnzX/Xin+2XBl8uDdQPg2 gcndrkJiNZ9Dfp6G8AKSDnaLDs8EftMdV6cZozBQm9HWvwqx+5AjzyoR9WqXs2kuhB+b OHbHrIY0L5bw0klT5V++dd4ZIjyG/h+RvgJeOuMmdcL2LMwTdLcGZghSR8zpXRYTU8vF nChwVNT2/pQvBK8fHBf12vdgFyKb/buP5mbmtSr9NUxEfZ+UerGKdsh8OgzfRjoERiSI 99Ew== X-Gm-Message-State: AJIora94RfNWbtBAVs4qSD80IpT7Wkp1CLF9TeBrTBOHJzckaDwPfnxb oiMm3VcgxS2/wgbl4akGxi65tIEcw2peFx7KGQ== X-Google-Smtp-Source: AGRyM1sfR9BLCzjhQ7iB9/w8T0nTXqnCY8GM70POd4QwcuIQdsEQRKXzL/APCV3KaFIEOVcpID4t0hTXIVbShLssFQ== X-Received: from justinstitt.mtv.corp.google.com ([2620:15c:211:202:f21c:9185:9405:36f]) (user=justinstitt job=sendgmr) by 2002:a25:907:0:b0:66e:3f14:c463 with SMTP id 7-20020a250907000000b0066e3f14c463mr6447554ybj.243.1657325741218; Fri, 08 Jul 2022 17:15:41 -0700 (PDT) Date: Fri, 8 Jul 2022 17:15:27 -0700 Message-Id: <20220709001527.618593-1-justinstitt@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog Subject: [PATCH] mediatek: mt76: eeprom: fix clang -Wformat warning From: Justin Stitt To: Jakub Kicinski , Kalle Valo , "David S . Miller" , Eric Dumazet , Paolo Abeni , Matthias Brugger Cc: Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Justin Stitt X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220708_171543_778825_F5664741 X-CRM114-Status: GOOD ( 11.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When building with Clang we encounter the following warning: | drivers/net/wireless/mediatek/mt7601u/eeprom.c:193:5: error: format | specifies type 'char' but the argument has type 'int' [-Werror,-Wformat] | chan_bounds[idx].start + chan_bounds[idx].num - 1); Variadic functions (printf-like) undergo default argument promotion. Documentation/core-api/printk-formats.rst specifically recommends using the promoted-to-type's format flag. Moreover, C11 6.3.1.1 states: (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf) `If an int can represent all values of the original type ..., the value is converted to an int; otherwise, it is converted to an unsigned int. These are called the integer promotions.` With this information in hand, we really should stop using `%hh[dxu]` or `%h[dxu]` as they usually prompt Clang -Wformat warnings as well as go against documented standard recommendations. Link: https://github.com/ClangBuiltLinux/linux/issues/378 Signed-off-by: Justin Stitt --- Note: produced warning with x86 allyesconfig. drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt7601u/eeprom.c b/drivers/net/wireless/mediatek/mt7601u/eeprom.c index aa3b64902cf9..625bebe60538 100644 --- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c +++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c @@ -188,7 +188,7 @@ mt7601u_set_country_reg(struct mt7601u_dev *dev, u8 *eeprom) if (idx != -1) dev_info(dev->dev, - "EEPROM country region %02hhx (channels %hhd-%hhd)\n", + "EEPROM country region %02x (channels %d-%d)\n", val, chan_bounds[idx].start, chan_bounds[idx].start + chan_bounds[idx].num - 1); else