lkml.org 
[lkml]   [2021]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 7/9] s390/block/dcssblk: add error handling support for add_disk()
    On Thu, Sep 02, 2021 at 10:41:03AM -0700, Luis Chamberlain wrote:
    > We never checked for errors on add_disk() as this function
    > returned void. Now that this is fixed, use the shiny new
    > error handling.
    >
    > Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
    > ---
    > drivers/s390/block/dcssblk.c | 4 +++-
    > 1 file changed, 3 insertions(+), 1 deletion(-)
    >
    > diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
    > index 5be3d1c39a78..b0fd5009a12e 100644
    > --- a/drivers/s390/block/dcssblk.c
    > +++ b/drivers/s390/block/dcssblk.c
    > @@ -696,7 +696,9 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
    > }
    >
    > get_device(&dev_info->dev);
    > - device_add_disk(&dev_info->dev, dev_info->gd, NULL);
    > + rc = device_add_disk(&dev_info->dev, dev_info->gd, NULL);
    > + if (rc)
    > + goto put_dev;

    This looks not correct to me. We seem to have now in case of an error:

    - reference count imbalance (= memory leak)
    - dax cleanup is missing

    \
     
     \ /
      Last update: 2021-09-03 16:09    [W:5.673 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site