* [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
@ 2018-10-01 10:00 ` Bartosz Golaszewski
0 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2018-10-01 10:00 UTC (permalink / raw)
To: Srinivas Kandagatla, David S . Miller, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Andrew Morton, Arnd Bergmann,
Jonathan Corbet, Sekhar Nori, Kevin Hilman, David Lechner,
Boris Brezillon, Andrew Lunn, Alban Bedel, Maxime Ripard,
Chen-Yu Tsai, Dan Carpenter
Cc: linux-doc, linux-kernel, linux-arm-kernel, Bartosz Golaszewski
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..8249621d11a6 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 = (struct nvmem_cell *)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.18.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
@ 2018-10-01 10:00 ` Bartosz Golaszewski
0 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2018-10-01 10:00 UTC (permalink / raw)
To: linux-arm-kernel
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..8249621d11a6 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 = (struct nvmem_cell *)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.18.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
2018-10-01 10:00 ` Bartosz Golaszewski
@ 2018-10-01 16:03 ` David Lechner
-1 siblings, 0 replies; 10+ messages in thread
From: David Lechner @ 2018-10-01 16:03 UTC (permalink / raw)
To: Bartosz Golaszewski, Srinivas Kandagatla, David S . Miller,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Andrew Morton,
Arnd Bergmann, Jonathan Corbet, Sekhar Nori, Kevin Hilman,
Boris Brezillon, Andrew Lunn, Alban Bedel, Maxime Ripard,
Chen-Yu Tsai, Dan Carpenter
Cc: linux-doc, linux-kernel, linux-arm-kernel, Bartosz Golaszewski
On 10/01/2018 05:00 AM, Bartosz Golaszewski wrote:
> 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..8249621d11a6 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 = (struct nvmem_cell *)nvmem;
perhaps ERR_CAST() would better indicate the intent here?
> 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;
> }
> }
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
@ 2018-10-01 16:03 ` David Lechner
0 siblings, 0 replies; 10+ messages in thread
From: David Lechner @ 2018-10-01 16:03 UTC (permalink / raw)
To: linux-arm-kernel
On 10/01/2018 05:00 AM, Bartosz Golaszewski wrote:
> 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..8249621d11a6 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 = (struct nvmem_cell *)nvmem;
perhaps ERR_CAST() would better indicate the intent here?
> 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;
> }
> }
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
2018-10-01 16:03 ` David Lechner
@ 2018-10-01 16:10 ` Bartosz Golaszewski
-1 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2018-10-01 16:10 UTC (permalink / raw)
To: David Lechner
Cc: Srinivas Kandagatla, David S . Miller, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Andrew Morton, Arnd Bergmann,
Jonathan Corbet, Sekhar Nori, Kevin Hilman, Boris Brezillon,
Andrew Lunn, Alban Bedel, Maxime Ripard, Chen-Yu Tsai,
Dan Carpenter, linux-doc, Linux Kernel Mailing List, Linux ARM,
Bartosz Golaszewski
pon., 1 paź 2018 o 18:03 David Lechner <david@lechnology.com> napisał(a):
>
> On 10/01/2018 05:00 AM, Bartosz Golaszewski wrote:
> > 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..8249621d11a6 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 = (struct nvmem_cell *)nvmem;
>
> perhaps ERR_CAST() would better indicate the intent here?
>
Wow so that exists too...
Thanks, I'll resend tomorrow.
Bart
> > 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;
> > }
> > }
> >
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
@ 2018-10-01 16:10 ` Bartosz Golaszewski
0 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2018-10-01 16:10 UTC (permalink / raw)
To: linux-arm-kernel
pon., 1 pa? 2018 o 18:03 David Lechner <david@lechnology.com> napisa?(a):
>
> On 10/01/2018 05:00 AM, Bartosz Golaszewski wrote:
> > 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..8249621d11a6 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 = (struct nvmem_cell *)nvmem;
>
> perhaps ERR_CAST() would better indicate the intent here?
>
Wow so that exists too...
Thanks, I'll resend tomorrow.
Bart
> > 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;
> > }
> > }
> >
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
2018-10-02 9:42 ` Bartosz Golaszewski
@ 2018-10-02 9:43 ` Bartosz Golaszewski
-1 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2018-10-02 9:43 UTC (permalink / raw)
To: Srinivas Kandagatla, David S . Miller, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Andrew Morton, Arnd Bergmann,
Jonathan Corbet, Sekhar Nori, Kevin Hilman, David Lechner,
Boris Brezillon, Andrew Lunn, Alban Bedel, Maxime Ripard,
Chen-Yu Tsai, Dan Carpenter
Cc: linux-doc, Linux Kernel Mailing List, Linux ARM, Bartosz Golaszewski
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
@ 2018-10-02 9:43 ` Bartosz Golaszewski
0 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2018-10-02 9:43 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
@ 2018-10-02 9:42 ` Bartosz Golaszewski
0 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2018-10-02 9:42 UTC (permalink / raw)
To: Srinivas Kandagatla, David S . Miller, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Andrew Morton, Arnd Bergmann,
Jonathan Corbet, Sekhar Nori, Kevin Hilman, David Lechner,
Boris Brezillon, Andrew Lunn, Alban Bedel, Maxime Ripard,
Chen-Yu Tsai, Dan Carpenter
Cc: linux-doc, linux-kernel, linux-arm-kernel, Bartosz Golaszewski
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] nvmem: fix nvmem_cell_get_from_lookup()
@ 2018-10-02 9:42 ` Bartosz Golaszewski
0 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2018-10-02 9:42 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-10-02 9:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01 10:00 [PATCH] nvmem: fix nvmem_cell_get_from_lookup() 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
2018-10-02 9:42 Bartosz Golaszewski
2018-10-02 9:42 ` Bartosz Golaszewski
2018-10-02 9:43 ` Bartosz Golaszewski
2018-10-02 9:43 ` Bartosz Golaszewski
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.