On Tue, Jul 04, 2023 at 02:21:28PM +0200, Jan Kara wrote:
> +struct bdev_handle *blkdev_get_handle_by_dev(dev_t dev, blk_mode_t mode,
> +             void *holder, const struct blk_holder_ops *hops)
> +{
> +     struct bdev_handle *handle = kmalloc(sizeof(struct bdev_handle),
> +                                          GFP_KERNEL);
> +     struct block_device *bdev;
> +
> +     if (!handle)
> +             return ERR_PTR(-ENOMEM);
> +     bdev = blkdev_get_by_dev(dev, mode, holder, hops);
> +     if (IS_ERR(bdev))
> +             return ERR_CAST(bdev);

Would we be better off with a handle->error (and a NULL return from this
function means "we couldn't allocate a handle")?  I have no objection
to what you've done here, just wondering if it might end up nicer for
the users.

Reply via email to