* [PATCH v1 1/1] ufs: mcq: qcom: Clean the return path of ufs_qcom_mcq_config_resource
@ 2023-03-02 1:42 Asutosh Das
2023-03-02 2:46 ` Bjorn Andersson
2023-03-02 7:29 ` Manivannan Sadhasivam
0 siblings, 2 replies; 3+ messages in thread
From: Asutosh Das @ 2023-03-02 1:42 UTC (permalink / raw)
To: quic_cang, martin.petersen, linux-scsi
Cc: quic_nguyenb, quic_xiaosenh, stanley.chu, adrian.hunter,
bvanassche, avri.altman, mani, beanhuo, Asutosh Das,
linux-arm-msm, Andy Gross, Bjorn Andersson, Konrad Dybcio,
James E.J. Bottomley, open list
Smatch static checker reported:
drivers/ufs/host/ufs-qcom.c:1469
ufs_qcom_mcq_config_resource() info: returning a literal zero is
cleaner
Fix the above warning by returning in place instead of a jump to a
label.
Also remove the usage of devm_kfree() as it's unnecessary in this
function.
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 | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 43b1fc1ad33e..cb20c7136c2c 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] ufs: mcq: qcom: Clean the return path of ufs_qcom_mcq_config_resource
2023-03-02 1:42 [PATCH v1 1/1] ufs: mcq: qcom: Clean the return path of ufs_qcom_mcq_config_resource Asutosh Das
@ 2023-03-02 2:46 ` Bjorn Andersson
2023-03-02 7:29 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2023-03-02 2:46 UTC (permalink / raw)
To: Asutosh Das
Cc: quic_cang, martin.petersen, linux-scsi, quic_nguyenb,
quic_xiaosenh, stanley.chu, adrian.hunter, bvanassche,
avri.altman, mani, beanhuo, linux-arm-msm, Andy Gross,
Konrad Dybcio, James E.J. Bottomley, open list
On Wed, Mar 01, 2023 at 05:42:56PM -0800, Asutosh Das wrote:
> Smatch static checker reported:
> drivers/ufs/host/ufs-qcom.c:1469
> ufs_qcom_mcq_config_resource() info: returning a literal zero is
> cleaner
>
> Fix the above warning by returning in place instead of a jump to a
> label.
> Also remove the usage of devm_kfree() as it's unnecessary in this
> function.
>
> 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 | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 43b1fc1ad33e..cb20c7136c2c 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -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;
This is a bug fix, so this needs to go in v6.3-rc
>
> 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);
This is just a cleanup, so there's no rush here.
So I would have preferred that these where split. But unless Martin
insist, I don't think it's worth the churn of spinning this one more
time...
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Regards,
Bjorn
> return ret;
> }
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] ufs: mcq: qcom: Clean the return path of ufs_qcom_mcq_config_resource
2023-03-02 1:42 [PATCH v1 1/1] ufs: mcq: qcom: Clean the return path of ufs_qcom_mcq_config_resource Asutosh Das
2023-03-02 2:46 ` Bjorn Andersson
@ 2023-03-02 7:29 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2023-03-02 7:29 UTC (permalink / raw)
To: Asutosh Das
Cc: quic_cang, martin.petersen, linux-scsi, quic_nguyenb,
quic_xiaosenh, stanley.chu, adrian.hunter, bvanassche,
avri.altman, beanhuo, linux-arm-msm, Andy Gross, Bjorn Andersson,
Konrad Dybcio, James E.J. Bottomley, open list
On Wed, Mar 01, 2023 at 05:42:56PM -0800, Asutosh Das wrote:
> Smatch static checker reported:
> drivers/ufs/host/ufs-qcom.c:1469
> ufs_qcom_mcq_config_resource() info: returning a literal zero is
> cleaner
>
> Fix the above warning by returning in place instead of a jump to a
> label.
> Also remove the usage of devm_kfree() as it's unnecessary in this
> function.
>
> 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>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Thanks,
Mani
> ---
> drivers/ufs/host/ufs-qcom.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 43b1fc1ad33e..cb20c7136c2c 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -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
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-02 7:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-02 1:42 [PATCH v1 1/1] ufs: mcq: qcom: Clean the return path of ufs_qcom_mcq_config_resource Asutosh Das
2023-03-02 2:46 ` Bjorn Andersson
2023-03-02 7:29 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox