Re: [PATCH] block: fix incorrect references to disk objects

From: Christoph Hellwig
Date: Mon Oct 18 2021 - 06:14:33 EST


On Mon, Oct 18, 2021 at 05:11:16PM +0800, Zqiang wrote:
> --- a/block/partitions/core.c
> +++ b/block/partitions/core.c
> @@ -424,6 +424,7 @@ static struct block_device *add_partition(struct gendisk *disk, int partno,
> device_del(pdev);
> out_put:
> put_device(pdev);
> + disk = NULL;
> out_put_disk:
> put_disk(disk);
> return ERR_PTR(err);

Stylistic nitpick: I think directly returning where this currently
clears disk would be a little easier to follow.