lkml.org 
[lkml]   [2020]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3 3/7] nvmem: increase the reference count of a gpio passed over config
    Date
    From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

    We can obtain the write-protect GPIO in nvmem_register() by requesting
    it ourselves or by storing the gpio_desc passed in nvmem_config. In the
    latter case we need to increase the reference count so that it gets
    freed correctly.

    Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
    ---
    drivers/nvmem/core.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
    index 89974e40d250..4e6daaa2b0f6 100644
    --- a/drivers/nvmem/core.c
    +++ b/drivers/nvmem/core.c
    @@ -348,7 +348,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
    return ERR_PTR(rval);
    }
    if (config->wp_gpio)
    - nvmem->wp_gpio = config->wp_gpio;
    + nvmem->wp_gpio = gpiod_ref(config->wp_gpio);
    else
    nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp",
    GPIOD_OUT_HIGH);
    --
    2.25.0
    \
     
     \ /
      Last update: 2020-02-19 10:23    [W:5.866 / U:0.308 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site