From: Asutosh Das <quic_asutoshd@quicinc.com>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: <quic_cang@quicinc.com>, <martin.petersen@oracle.com>,
<linux-scsi@vger.kernel.org>, <quic_nguyenb@quicinc.com>,
<quic_xiaosenh@quicinc.com>, <stanley.chu@mediatek.com>,
<adrian.hunter@intel.com>, <bvanassche@acm.org>,
<avri.altman@wdc.com>, <beanhuo@micron.com>,
<linux-arm-msm@vger.kernel.org>, Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 1/1] ufs: mcq: qcom: Fix Smatch static checker warning
Date: Wed, 1 Mar 2023 10:13:19 -0800 [thread overview]
Message-ID: <20230301181319.GE10301@asutoshd-linux1.qualcomm.com> (raw)
In-Reply-To: <20230301070508.GA5409@thinkpad>
On Wed, Mar 01 2023 at 23:05 -0800, Manivannan Sadhasivam wrote:
>On Tue, Feb 28, 2023 at 10:27:06AM -0800, Asutosh Das wrote:
>> The patch (c263b4ef737e: "scsi: ufs: core: mcq: Configure resource
>> regions") from Jan 13, 2023, leads to the following Smatch static
>> checker warning:
>>
>> drivers/ufs/host/ufs-qcom.c:1455 ufs_qcom_mcq_config_resource() warn:
>> passing zero to 'PTR_ERR'
>> drivers/ufs/host/ufs-qcom.c:1469 ufs_qcom_mcq_config_resource() info:
>> returning a literal zero is cleaner
>>
>> Fix the above warnings.
>>
>
>You should not name the subject after the tool that used to find the issues.
>Instead, subject should mention the actual issue like fixing return values,
>removing the devm_kfree in error path etc...
>
>Provided that, you should also split this patch into two as you are fixing
>two independent issues.
>
>Thanks,
>Mani
>
Thanks for taking a look.
I will fix it in the next version.
-Asd
>> Fixes: c263b4ef737e ("scsi: ufs: core: mcq: Configure resource regions")
>> Reported-by: Dan Carpenter <error27@gmail.com>
>> Signed-off-by: Asutosh Das <quic_asutoshd@quicinc.com>
>> ---
>> drivers/ufs/host/ufs-qcom.c | 8 +++-----
>> 1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
>> index 34fc453f3eb1..cb20c7136c2c 100644
>> --- a/drivers/ufs/host/ufs-qcom.c
>> +++ b/drivers/ufs/host/ufs-qcom.c
>> @@ -1451,8 +1451,8 @@ static int ufs_qcom_mcq_config_resource(struct ufs_hba *hba)
>> if (IS_ERR(res->base)) {
>> dev_err(hba->dev, "Failed to map res %s, err=%d\n",
>> res->name, (int)PTR_ERR(res->base));
>> - res->base = NULL;
>> ret = PTR_ERR(res->base);
>> + res->base = NULL;
>> return ret;
>> }
>> }
>> @@ -1466,7 +1466,7 @@ static int ufs_qcom_mcq_config_resource(struct ufs_hba *hba)
>> /* Explicitly allocate MCQ resource from ufs_mem */
>> res_mcq = devm_kzalloc(hba->dev, sizeof(*res_mcq), GFP_KERNEL);
>> if (!res_mcq)
>> - return ret;
>> + return -ENOMEM;
>>
>> res_mcq->start = res_mem->start +
>> MCQ_SQATTR_OFFSET(hba->mcq_capabilities);
>> @@ -1478,7 +1478,7 @@ static int ufs_qcom_mcq_config_resource(struct ufs_hba *hba)
>> if (ret) {
>> dev_err(hba->dev, "Failed to insert MCQ resource, err=%d\n",
>> ret);
>> - goto insert_res_err;
>> + return ret;
>> }
>>
>> res->base = devm_ioremap_resource(hba->dev, res_mcq);
>> @@ -1495,8 +1495,6 @@ static int ufs_qcom_mcq_config_resource(struct ufs_hba *hba)
>> ioremap_err:
>> res->base = NULL;
>> remove_resource(res_mcq);
>> -insert_res_err:
>> - devm_kfree(hba->dev, res_mcq);
>> return ret;
>> }
>>
>> --
>> 2.7.4
>>
>
>--
>மணிவண்ணன் சதாசிவம்
prev parent reply other threads:[~2023-03-01 18:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-28 18:27 [PATCH v1 1/1] ufs: mcq: qcom: Fix Smatch static checker warning Asutosh Das
2023-03-01 7:05 ` Manivannan Sadhasivam
2023-03-01 18:13 ` Asutosh Das [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230301181319.GE10301@asutoshd-linux1.qualcomm.com \
--to=quic_asutoshd@quicinc.com \
--cc=adrian.hunter@intel.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=jejb@linux.ibm.com \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mani@kernel.org \
--cc=martin.petersen@oracle.com \
--cc=quic_cang@quicinc.com \
--cc=quic_nguyenb@quicinc.com \
--cc=quic_xiaosenh@quicinc.com \
--cc=stanley.chu@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox