All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	"David S . Miller" <davem@davemloft.net>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>, Jonathan Corbet <corbet@lwn.net>,
	Sekhar Nori <nsekhar@ti.com>, Kevin Hilman <khilman@kernel.org>,
	David Lechner <david@lechnology.com>,
	Boris Brezillon <boris.brezillon@bootlin.com>,
	Andrew Lunn <andrew@lunn.ch>, Alban Bedel <albeu@free.fr>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Chen-Yu Tsai <wens@csie.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-doc <linux-doc@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
Date: Tue, 2 Oct 2018 11:43:22 +0200	[thread overview]
Message-ID: <CAMRc=Mdu1BZKA89OEjrB7Ti5nZujpO=_jk4EBaxjpESnFgZm1w@mail.gmail.com> (raw)
In-Reply-To: <20181002094238.17571-1-brgl@bgdev.pl>

wt., 2 paź 2018 o 11:42 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
>
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> We check if the pointer returned by __nvmem_device_get() is not NULL
> while we should actually check if it is not IS_ERR(nvmem). Fix it.
>
> While we're at it: fix the next error path where we should assign an
> error value to cell before returning.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/nvmem/core.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index ad1227df1984..f49474e1ad49 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -952,9 +952,9 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id)
>                     (strcmp(lookup->con_id, con_id) == 0)) {
>                         /* This is the right entry. */
>                         nvmem = __nvmem_device_get(NULL, lookup->nvmem_name);
> -                       if (!nvmem) {
> +                       if (IS_ERR(nvmem)) {
>                                 /* Provider may not be registered yet. */
> -                               cell = ERR_PTR(-EPROBE_DEFER);
> +                               cell = ERR_CAST(nvmem);
>                                 goto out;
>                         }
>
> @@ -962,6 +962,7 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id)
>                                                        lookup->cell_name);
>                         if (!cell) {
>                                 __nvmem_device_put(nvmem);
> +                               cell = ERR_PTR(-ENOENT);
>                                 goto out;
>                         }
>                 }
> --
> 2.19.0
>

Ugh this was supposed to be v2. Sorry for spamming.

Bart

WARNING: multiple messages have this Message-ID (diff)
From: brgl@bgdev.pl (Bartosz Golaszewski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
Date: Tue, 2 Oct 2018 11:43:22 +0200	[thread overview]
Message-ID: <CAMRc=Mdu1BZKA89OEjrB7Ti5nZujpO=_jk4EBaxjpESnFgZm1w@mail.gmail.com> (raw)
In-Reply-To: <20181002094238.17571-1-brgl@bgdev.pl>

wt., 2 pa? 2018 o 11:42 Bartosz Golaszewski <brgl@bgdev.pl> napisa?(a):
>
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> We check if the pointer returned by __nvmem_device_get() is not NULL
> while we should actually check if it is not IS_ERR(nvmem). Fix it.
>
> While we're at it: fix the next error path where we should assign an
> error value to cell before returning.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/nvmem/core.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index ad1227df1984..f49474e1ad49 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -952,9 +952,9 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id)
>                     (strcmp(lookup->con_id, con_id) == 0)) {
>                         /* This is the right entry. */
>                         nvmem = __nvmem_device_get(NULL, lookup->nvmem_name);
> -                       if (!nvmem) {
> +                       if (IS_ERR(nvmem)) {
>                                 /* Provider may not be registered yet. */
> -                               cell = ERR_PTR(-EPROBE_DEFER);
> +                               cell = ERR_CAST(nvmem);
>                                 goto out;
>                         }
>
> @@ -962,6 +962,7 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id)
>                                                        lookup->cell_name);
>                         if (!cell) {
>                                 __nvmem_device_put(nvmem);
> +                               cell = ERR_PTR(-ENOENT);
>                                 goto out;
>                         }
>                 }
> --
> 2.19.0
>

Ugh this was supposed to be v2. Sorry for spamming.

Bart

  reply	other threads:[~2018-10-02  9:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02  9:42 [PATCH] nvmem: fix nvmem_cell_get_from_lookup() Bartosz Golaszewski
2018-10-02  9:42 ` Bartosz Golaszewski
2018-10-02  9:43 ` Bartosz Golaszewski [this message]
2018-10-02  9:43   ` Bartosz Golaszewski
  -- strict thread matches above, loose matches on Subject: below --
2018-10-01 10:00 Bartosz Golaszewski
2018-10-01 10:00 ` Bartosz Golaszewski
2018-10-01 16:03 ` David Lechner
2018-10-01 16:03   ` David Lechner
2018-10-01 16:10   ` Bartosz Golaszewski
2018-10-01 16:10     ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMRc=Mdu1BZKA89OEjrB7Ti5nZujpO=_jk4EBaxjpESnFgZm1w@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=akpm@linux-foundation.org \
    --cc=albeu@free.fr \
    --cc=andrew@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=bgolaszewski@baylibre.com \
    --cc=boris.brezillon@bootlin.com \
    --cc=corbet@lwn.net \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=david@lechnology.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=mchehab+samsung@kernel.org \
    --cc=nsekhar@ti.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.