Linux-SCSI Archive on lore.kernel.org
 help / color / Atom feed
From: dinghao.liu@zju.edu.cn
To: "Bean Huo (beanhuo)" <beanhuo@micron.com>
Cc: "kjlu@umn.edu" <kjlu@umn.edu>,
	"Alim Akhtar" <alim.akhtar@samsung.com>,
	"Avri Altman" <avri.altman@wdc.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"Bart Van Assche" <bvanassche@acm.org>,
	"Can Guo" <cang@codeaurora.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: RE: [EXT] [PATCH] scsi: ufs-bsg: Fix runtime PM imbalance on error
Date: Fri, 22 May 2020 16:54:48 +0800 (GMT+08:00)
Message-ID: <4a6ba414.bf5c4.1723b9792df.Coremail.dinghao.liu@zju.edu.cn> (raw)
In-Reply-To: <SN6PR08MB56932A6D579AFB4E28AFD001DBB40@SN6PR08MB5693.namprd08.prod.outlook.com>

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

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22  4:59 Dinghao Liu
2020-05-22  8:36 ` [EXT] " Bean Huo (beanhuo)
2020-05-22  8:54   ` dinghao.liu [this message]
2020-05-22 14:55     ` Bean Huo (beanhuo)
2020-05-23 10:10       ` dinghao.liu

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=4a6ba414.bf5c4.1723b9792df.Coremail.dinghao.liu@zju.edu.cn \
    --to=dinghao.liu@zju.edu.cn \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=jejb@linux.ibm.com \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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

Linux-SCSI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-scsi/0 linux-scsi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-scsi linux-scsi/ https://lore.kernel.org/linux-scsi \
		linux-scsi@vger.kernel.org
	public-inbox-index linux-scsi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-scsi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git