lkml.org 
[lkml]   [2018]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.18 164/350] nvmem: check the return value of nvmem_add_cells()
    Date
    4.18-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

    [ Upstream commit fa72d847d68d7833b77a4bef944cf2c5baf56f49 ]

    This function can fail so check its return value in nvmem_register()
    and act accordingly.

    Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/nvmem/core.c | 10 ++++++++--
    1 file changed, 8 insertions(+), 2 deletions(-)

    --- a/drivers/nvmem/core.c
    +++ b/drivers/nvmem/core.c
    @@ -518,11 +518,17 @@ struct nvmem_device *nvmem_register(cons
    goto err_device_del;
    }

    - if (config->cells)
    - nvmem_add_cells(nvmem, config->cells, config->ncells);
    + if (config->cells) {
    + rval = nvmem_add_cells(nvmem, config->cells, config->ncells);
    + if (rval)
    + goto err_teardown_compat;
    + }

    return nvmem;

    +err_teardown_compat:
    + if (config->compat)
    + device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom);
    err_device_del:
    device_del(&nvmem->dev);
    err_put_device:

    \
     
     \ /
      Last update: 2018-11-12 00:55    [W:4.084 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site