All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
To: Ming Lei <ming.lei@redhat.com>, Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Subject: Re: [PATCH V2 1/5] ublk_drv: avoid to leak ublk device in case that add_disk fails
Date: Thu, 28 Jul 2022 10:57:47 +0800	[thread overview]
Message-ID: <21ba242e-c936-f1c1-1d9e-1cdaddcbfd31@linux.alibaba.com> (raw)
In-Reply-To: <YuHV11N1A45xwxyT@T590>

On 2022/7/28 08:18, Ming Lei wrote:
> On Wed, Jul 27, 2022 at 06:21:32PM +0200, Christoph Hellwig wrote:
>> maybe s/avoid/don't/ in the subject?
> 
> OK, will change in V3.
> 
>>
>>> -	get_device(&ub->cdev_dev);
>>>  	ret = add_disk(disk);
>>>  	if (ret) {
>>>  		put_disk(disk);
>>>  		goto out_unlock;
>>
>> Maybe just add a put_device here in the error branch to keep
>> things simple?
> 
> That is fine.
> 
> Another way is to add 'out_put_disk' error label which can be
> reused with previous error handling.

+1, adding another error label looks clear and simple.

  reply	other threads:[~2022-07-28  2:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-27 14:16 [PATCH V2 0/5] ublk_drv: add generic mechanism to get/set parameters Ming Lei
2022-07-27 14:16 ` [PATCH V2 1/5] ublk_drv: avoid to leak ublk device in case that add_disk fails Ming Lei
2022-07-27 16:21   ` Christoph Hellwig
2022-07-28  0:18     ` Ming Lei
2022-07-28  2:57       ` Ziyang Zhang [this message]
2022-07-27 14:16 ` [PATCH V2 2/5] ublk_drv: cancel device even though disk isn't up Ming Lei
2022-07-27 14:16 ` [PATCH V2 3/5] ublk_drv: add SET_PARAM/GET_PARAM control command Ming Lei
2022-07-27 16:22   ` Christoph Hellwig
2022-07-28  1:56     ` Ming Lei
2022-07-28  4:38       ` Ming Lei
2022-07-27 14:16 ` [PATCH V2 4/5] ublk_drv: add two parameter types Ming Lei
2022-07-27 14:16 ` [PATCH V2 5/5] ublk_drv: cleanup ublksrv_ctrl_dev_info Ming Lei

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=21ba242e-c936-f1c1-1d9e-1cdaddcbfd31@linux.alibaba.com \
    --to=ziyangzhang@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.