Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4839716pxv; Tue, 27 Jul 2021 18:37:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3dmdO7zbJY4K+1fmydLr2AVJEpeZlye9Uthb+6BYvowwxLiqonUjR8wEbM4rR0ew4cNHK X-Received: by 2002:a17:906:b351:: with SMTP id cd17mr6136974ejb.36.1627436223645; Tue, 27 Jul 2021 18:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627436223; cv=none; d=google.com; s=arc-20160816; b=uEV1mQBeD4M/D1tnOe4EsuMkn0QCeZbOYAUCCC2nLiWmsQLUcNniy/cwh6jr+YFl3R uOa7R/GrTqJOQXiGnBIPf0JUi639RGTetyO+59C4iYfv/Rsna6kugz4OVb5MFf4DdZVg BdRKFGcK6s9DxJX1vhTjRftpxibmtyllb6p1ybr15lVeQSuO8HoHfCNgXB6zurJ6Cq0C N//QVcOIzC2BBaleGpewOs4DsqQ6gdLpsZXrm863hE3sV4WD2DGA7ljAoXGzEWtsANZr DAiMDsmPItxKOPpx/Ynz166JgEUkGNwq8HavTuHlaj7BScBvYkpZsJf/yOpu5PIFkgKK MCfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=6IzKUwr8XQgYi9+GEHJuey1GAhkswlOFHf5KxVJOX/o=; b=L+dNz0ZiMGVjvMk0DdmNM7MNOeDi4/1+N2YMi43ug1Mk3jCbVLDNkPym+0+WL3Spzj 7ggvaMDPqtlO5QVR/J7mH8udCSGJYT2Sc9LlswwqLZxle90ZhjzTwrvjdsxvdgkxTAV9 /8qS7VuP6icipyWFOLh8lbr5EiEqzCPNIhq39xPXYh08pEGeRNk2+acpPlfpAkLuJs+L 04BzlycJZ2U2g2iu5dV6gurarROUXKykf5A7+WQ9exBDCGL0LfBHl6kOxwTFWIwf3M9O Gz/iC0KlRF/48b/q6KX+EOoecT+/qfB7Fn2wlmW4HPm8IfEN3u76PdY8MoQV7zKW7GNX WrnA== 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 a21si4306397eds.445.2021.07.27.18.36.41; Tue, 27 Jul 2021 18:37:03 -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 S234677AbhG1Bcw (ORCPT + 99 others); Tue, 27 Jul 2021 21:32:52 -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