From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08304C4320A for ; Wed, 28 Jul 2021 01:32:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DEBAC60C3E for ; Wed, 28 Jul 2021 01:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234723AbhG1Bcx (ORCPT ); Tue, 27 Jul 2021 21:32:53 -0400 Received: from cmccmta3.chinamobile.com ([221.176.66.81]:63796 "EHLO cmccmta3.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232786AbhG1Bcv (ORCPT ); Tue, 27 Jul 2021 21:32:51 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.19]) by rmmx-syy-dmz-app11-12011 (RichMail) with SMTP id 2eeb6100b39f616-9ed92; Wed, 28 Jul 2021 09:32:15 +0800 (CST) X-RM-TRANSID: 2eeb6100b39f616-9ed92 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from [192.168.26.114] (unknown[10.42.68.12]) by rmsmtp-syy-appsvr10-12010 (RichMail) with SMTP id 2eea6100b39e4e1-ba505; Wed, 28 Jul 2021 09:32:15 +0800 (CST) X-RM-TRANSID: 2eea6100b39e4e1-ba505 Subject: Re: [PATCH] nfc: s3fwrn5: fix undefined parameter values in dev_err() To: Nathan Chancellor Cc: k.opasiak@samsung.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shengju References: <20210727122506.6900-1-tangbin@cmss.chinamobile.com> From: tangbin Message-ID: Date: Wed, 28 Jul 2021 09:32:42 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nathan: On 2021/7/28 1:34, Nathan Chancellor wrote: > On Tue, Jul 27, 2021 at 08:25:06PM +0800, Tang Bin wrote: >> In the function s3fwrn5_fw_download(), the 'ret' is not assigned, >> so the correct value should be given in dev_err function. >> >> Fixes: a0302ff5906a ("nfc: s3fwrn5: remove unnecessary label") >> Signed-off-by: Zhang Shengju >> Signed-off-by: Tang Bin > This clears up a clang warning that I see: > > drivers/nfc/s3fwrn5/firmware.c:425:41: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized] > "Cannot allocate shash (code=%d)\n", ret); > ^~~ > ./include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err' > dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__) > ^~~~~~~~~~~ > ./include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap' > _p_func(dev, fmt, ##__VA_ARGS__); \ > ^~~~~~~~~~~ > drivers/nfc/s3fwrn5/firmware.c:416:9: note: initialize the variable 'ret' to silence this warning > int ret; > ^ > = 0 > 1 error generated. > > One comment below but regardless: > > Reviewed-by: Nathan Chancellor > >> --- >> drivers/nfc/s3fwrn5/firmware.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c >> index 1421ffd46d9a..52c6f76adfb2 100644 >> --- a/drivers/nfc/s3fwrn5/firmware.c >> +++ b/drivers/nfc/s3fwrn5/firmware.c >> @@ -422,7 +422,7 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info) >> tfm = crypto_alloc_shash("sha1", 0, 0); >> if (IS_ERR(tfm)) { >> dev_err(&fw_info->ndev->nfc_dev->dev, >> - "Cannot allocate shash (code=%d)\n", ret); >> + "Cannot allocate shash (code=%d)\n", PTR_ERR(tfm)); > We know this is going to be an error pointer so this could be changed to > > "Cannot allocate shash (code=%pe)\n", tfm); > > to make it a little cleaner to understand. See commit 57f5677e535b > ("printf: add support for printing symbolic error names"). Got it. My patch is looks like a revert, so in the dev_err I used 'PTR_ERR(tfm)'. After your suggestion, I will send V2 for you. Thanks Tang Bin > >> return PTR_ERR(tfm); >> } >> >> -- >> 2.18.2 > Cheers, > Nathan