[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4a6ba414.bf5c4.1723b9792df.Coremail.dinghao.liu@zju.edu.cn>
Date: Fri, 22 May 2020 16:54:48 +0800 (GMT+08:00)
From: dinghao.liu@....edu.cn
To: "Bean Huo (beanhuo)" <beanhuo@...ron.com>
Cc: "kjlu@....edu" <kjlu@....edu>,
"Alim Akhtar" <alim.akhtar@...sung.com>,
"Avri Altman" <avri.altman@....com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
"Bart Van Assche" <bvanassche@....org>,
"Can Guo" <cang@...eaurora.org>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: RE: [EXT] [PATCH] scsi: ufs-bsg: Fix runtime PM imbalance on
error
Hi, Bean
Thank you for your advice! Moving original pm_runtime_put_sync()
to after "out" label will influence an error path branched from
ups_bsg_verify_query_size(). So I think changing "goto out" to
"break" is a good idea. But in this case we may execute an extra
sg_copy_from_buffer() and an extra kfree() compared with unpatched
version. Does this matter?
Regards,
Dinghao
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> Hi, Dinghao
> >
> > diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c index
> > 53dd87628cbe..516a7f573942 100644
> > --- a/drivers/scsi/ufs/ufs_bsg.c
> > +++ b/drivers/scsi/ufs/ufs_bsg.c
> > @@ -106,8 +106,10 @@ static int ufs_bsg_request(struct bsg_job *job)
> > desc_op = bsg_request->upiu_req.qr.opcode;
> > ret = ufs_bsg_alloc_desc_buffer(hba, job, &desc_buff,
> > &desc_len, desc_op);
> > - if (ret)
> > + if (ret) {
> > + pm_runtime_put_sync(hba->dev);
>
> No need to add pm_runtime_put_sync() here, you can change "goto out" to "break",
> Or move original pm_runtime_put_sync() to after goto label.
>
> > goto out;
> > + }
> >
> > /* fall through */
> > case UPIU_TRANSACTION_NOP_OUT:
> > --
> > 2.17.1
Powered by blists - more mailing lists