[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2e3adf52-8d9f-bb6d-5f02-cc3032e9b1ab@acm.org>
Date: Wed, 9 Nov 2022 13:21:46 -0800
From: Bart Van Assche <bvanassche@....org>
To: Asutosh Das <quic_asutoshd@...cinc.com>, quic_cang@...cinc.com,
martin.petersen@...cle.com, linux-scsi@...r.kernel.org
Cc: quic_nguyenb@...cinc.com, quic_xiaosenh@...cinc.com,
stanley.chu@...iatek.com, eddie.huang@...iatek.com,
daejun7.park@...sung.com, avri.altman@....com, mani@...nel.org,
beanhuo@...ron.com, linux-arm-msm@...r.kernel.org,
Alim Akhtar <alim.akhtar@...sung.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 06/16] ufs: core: mcq: Configure resource regions
On 11/9/22 11:41, Asutosh Das wrote:
> + /* Manually allocate MCQ resource from ufs_mem */
Manually -> explicitly? The meaning of "manually" is "by hand and not by
machine". Software is always executed by a CPU (machine) so nothing
happens manually in software.
> + ret = insert_resource(&iomem_resource, res_mcq);
> + if (ret) {
> + dev_err(hba->dev, "Failed to insert MCQ resource, err=%d\n",
> + ret);
> + devm_kfree(hba->dev, res_mcq);
> + return ret;
> + }
> +
> + res->base = devm_ioremap_resource(hba->dev, res_mcq);
> + if (IS_ERR(res->base)) {
> + dev_err(hba->dev, "MCQ registers mapping failed, err=%d\n",
> + (int)PTR_ERR(res->base));
> + ret = PTR_ERR(res->base);
> + res->base = NULL;
> + remove_resource(res_mcq);
> + devm_kfree(hba->dev, res_mcq);
> + return ret;
> + }
I see duplicated code in error paths. Please move the code for freeing
resources past the "return 0" statement and use goto statements to jump
to that code in case of an error.
Thanks,
Bart.
Powered by blists - more mailing lists