Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp28291imi; Thu, 21 Jul 2022 15:13:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u0VqyXv3MjBCMtkJgJiS5pXp7UYfdakuGz/FUx/x3vweya01j4dBU7KpCLSSBxgYAdFdyA X-Received: by 2002:a05:6402:950:b0:43a:5194:174c with SMTP id h16-20020a056402095000b0043a5194174cmr499877edz.145.1658441590057; Thu, 21 Jul 2022 15:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658441590; cv=none; d=google.com; s=arc-20160816; b=HcJSXOYsDTz7bg0VudoS+sec0ksE8EW1nfsxnK5uBjYD4XOAfqeaSzwtdPcuD9UwP3 V8xZL7ZvLvpTv92roPV7aBYKBquj3a+KKBv9EcVRd/n0+HZ3EXmqgPFRYkjoXUEm381z c0WPKLYI/HnvDElABaVcwf0VZlNGN6+tetNvomWTT0wotv4DQe4D0M68y3CG36RND+4w evPcat9Ln6Xmx7R0vOg1c5UCYV/tKVU8I6+OnNkWAEzrozrlDyMRD8G8is4BMJMDGRj3 OOX6rg8z3w/SrT1uOaR29bzyk3WSZ5juE+lT24kJF52yi7PRTacohcJ3r7KLfZLHIaAx qFGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5xidbUrTcxXPIxrZbuRQ6TMt/AepDVuRwSAvY8v4sz4=; b=eieUC2RG26bPrIV7xUgujpCTWdfFBx/97bgfKa4k+e78UBbqkyTFfe3eN0jd1u9uCn akULe1tw4qnSH3pRGXLhES8lL58j4on+YCmNarRAXwc6VL7cT+yi80cb1HpOgwy1gCyA YpBKZPLD9JZdv68yAu9lR0EhNjmRbKF8M7gaIQFLfPoWP5m2kUNHXmdOqGYoiK9T+iYG LRK3Q1DA5nnUrzFVw1Ash8heSxz0Uxlyu4F+oEEeXD37govrYrZLXtWh9fzYCN0+jh0p 037alEIYBP4XKMZkv3VbxQM+/qUxsHvucLzu3ZOhWTN2PEdgoMElH4y8laKmnZeZkaNR LagQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b6dgBxwP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs31-20020a1709073e9f00b0072b5b059778si4101650ejc.1003.2022.07.21.15.12.37; Thu, 21 Jul 2022 15:13:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b6dgBxwP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233710AbiGUVWi (ORCPT + 99 others); Thu, 21 Jul 2022 17:22:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbiGUVWh (ORCPT ); Thu, 21 Jul 2022 17:22:37 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18F6D9284B for ; Thu, 21 Jul 2022 14:22:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6F6DACE25B3 for ; Thu, 21 Jul 2022 21:22:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD762C3411E; Thu, 21 Jul 2022 21:22:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658438552; bh=2csh2IPzZB9Q9+L8yOL8SYU7r0lrEKvI5elBmtDV4/c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=b6dgBxwPawsXvrs8FUNrO+XL/BjA70/JzCpatMpkSzj7k4H1NCNOiotZyhdFxGAVC PP0TouGwpOyksZ+JkyaViKZi3wwSpRxAUa4jll8RuuLciixdPnP+QJ8lxUivlSpKsB IZaLl9ccELLbadWEDYu2IUFTzanj8FANZM1pKkqE8MnVhWfswSrv0nZn71HKHlkutm rTvsprQlzBRrdkkI6jlkYjSpIZgIRtAsx7h78aYQqKCBAMIfBoZolXCk9gp8uaOVoL jXUd9dVTvLgfSfSAipukCS4ycfOPt6bw0Whg/TNDhpzYHimHr2ZCe/fZQOmVqeudAP 26pIQWRO6TIwQ== Date: Thu, 21 Jul 2022 14:22:30 -0700 From: Nathan Chancellor To: Justin Stitt Cc: Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Mark Brown , Jaroslav Kysela , Takashi Iwai , Nick Desaulniers , Kai Vehmanen , Tom Rix , sound-open-firmware@alsa-project.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] soc: sof: fix clang -Wformat warnings Message-ID: References: <20220721211218.4039288-1-justinstitt@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220721211218.4039288-1-justinstitt@google.com> X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 21, 2022 at 02:12:18PM -0700, Justin Stitt wrote: > When building with Clang we encounter these warnings: > | sound/soc/sof/ipc3-topology.c:2343:4: error: format specifies type > | 'unsigned char' but the argument has type 'int' [-Werror,-Wformat] > | SOF_ABI_MAJOR, SOF_ABI_MINOR, SOF_ABI_PATCH); > | ^~~~~~~~~~~~~~~^~~~~~~~~~~~~~~^~~~~~~~~~~~~ > > Use correct format specifier `%d` since args are of type int. > > Link: https://github.com/ClangBuiltLinux/linux/issues/378 > Reported-by: Nathan Chancellor > Suggested-by: Nathan Chancellor > Signed-off-by: Justin Stitt Indeed, decimal integer literals with no suffix are of type 'int' when they can fit in an 'int'. In this case, there shouldn't be a bug since the values of these macros can fit in an 'unsigned char' (so no truncation) but it is still correct to use '%d' instead of '%hhu', which matches the stance of commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]"). This was introduced by commit 323aa1f093e6 ("ASoC: SOF: Add a new IPC op for parsing topology manifest"), not sure it warrants a fixes tag for the reason I outlined above, but it might be helpful for other reviewers. Reviewed-by: Nathan Chancellor > --- > Reported by Nathan here: > https://lore.kernel.org/all/YtmrCJjQrSbv8Aj1@dev-arch.thelio-3990X/ > > sound/soc/sof/ipc3-topology.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c > index b2cc046b9f60..65923e7a5976 100644 > --- a/sound/soc/sof/ipc3-topology.c > +++ b/sound/soc/sof/ipc3-topology.c > @@ -2338,7 +2338,7 @@ static int sof_ipc3_parse_manifest(struct snd_soc_component *scomp, int index, > } > > dev_info(scomp->dev, > - "Topology: ABI %d:%d:%d Kernel ABI %hhu:%hhu:%hhu\n", > + "Topology: ABI %d:%d:%d Kernel ABI %d:%d:%d\n", > man->priv.data[0], man->priv.data[1], man->priv.data[2], > SOF_ABI_MAJOR, SOF_ABI_MINOR, SOF_ABI_PATCH); > > -- > 2.37.1.359.gd136c6c3e2-goog >