All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: ohci-da8xx: ensure error return on variable error is set
@ 2020-01-06 13:06 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2020-01-06 13:06 UTC (permalink / raw)
  To: Alan Stern, Greg Kroah-Hartman, Sekhar Nori, Bartosz Golaszewski,
	linux-usb
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently when an error in da8xx_ohci->oc_gpi occurs causes an
uninitialized error value in variable 'error' to be returned. 
Fix this by ensuring the error variable is set to the error value
in da8xx_ohci->oc_gpi.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: d193abf1c913 ("usb: ohci-da8xx: add vbus and overcurrent gpios")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/usb/host/ohci-da8xx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index 38183ac438c6..9cdf787055b7 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -415,8 +415,10 @@ static int ohci_da8xx_probe(struct platform_device *pdev)
 	}
 
 	da8xx_ohci->oc_gpio = devm_gpiod_get_optional(dev, "oc", GPIOD_IN);
-	if (IS_ERR(da8xx_ohci->oc_gpio))
+	if (IS_ERR(da8xx_ohci->oc_gpio)) {
+		error = PTR_ERR(da8xx_ohci->oc_gpio);
 		goto err;
+	}
 
 	if (da8xx_ohci->oc_gpio) {
 		oc_irq = gpiod_to_irq(da8xx_ohci->oc_gpio);
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] usb: ohci-da8xx: ensure error return on variable error is set
@ 2020-01-06 13:06 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2020-01-06 13:06 UTC (permalink / raw)
  To: Alan Stern, Greg Kroah-Hartman, Sekhar Nori, Bartosz Golaszewski,
	linux-usb
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently when an error in da8xx_ohci->oc_gpi occurs causes an
uninitialized error value in variable 'error' to be returned. 
Fix this by ensuring the error variable is set to the error value
in da8xx_ohci->oc_gpi.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: d193abf1c913 ("usb: ohci-da8xx: add vbus and overcurrent gpios")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/usb/host/ohci-da8xx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index 38183ac438c6..9cdf787055b7 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -415,8 +415,10 @@ static int ohci_da8xx_probe(struct platform_device *pdev)
 	}
 
 	da8xx_ohci->oc_gpio = devm_gpiod_get_optional(dev, "oc", GPIOD_IN);
-	if (IS_ERR(da8xx_ohci->oc_gpio))
+	if (IS_ERR(da8xx_ohci->oc_gpio)) {
+		error = PTR_ERR(da8xx_ohci->oc_gpio);
 		goto err;
+	}
 
 	if (da8xx_ohci->oc_gpio) {
 		oc_irq = gpiod_to_irq(da8xx_ohci->oc_gpio);
-- 
2.24.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: ohci-da8xx: ensure error return on variable error is set
  2020-01-06 13:06 ` Colin King
@ 2020-01-06 16:06   ` Sergei Shtylyov
  -1 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2020-01-06 16:06 UTC (permalink / raw)
  To: Colin King, Alan Stern, Greg Kroah-Hartman, Sekhar Nori,
	Bartosz Golaszewski, linux-usb
  Cc: kernel-janitors, linux-kernel

On 01/06/2020 04:06 PM, Colin King wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently when an error in da8xx_ohci->oc_gpi occurs causes an

   s/gpi/gpio/. And you missed a noun between 2 verbs.

> uninitialized error value in variable 'error' to be returned. 
> Fix this by ensuring the error variable is set to the error value
> in da8xx_ohci->oc_gpi.

   oc_gpio again.

> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: d193abf1c913 ("usb: ohci-da8xx: add vbus and overcurrent gpios")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: ohci-da8xx: ensure error return on variable error is set
@ 2020-01-06 16:06   ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2020-01-06 16:06 UTC (permalink / raw)
  To: Colin King, Alan Stern, Greg Kroah-Hartman, Sekhar Nori,
	Bartosz Golaszewski, linux-usb
  Cc: kernel-janitors, linux-kernel

On 01/06/2020 04:06 PM, Colin King wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently when an error in da8xx_ohci->oc_gpi occurs causes an

   s/gpi/gpio/. And you missed a noun between 2 verbs.

> uninitialized error value in variable 'error' to be returned. 
> Fix this by ensuring the error variable is set to the error value
> in da8xx_ohci->oc_gpi.

   oc_gpio again.

> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: d193abf1c913 ("usb: ohci-da8xx: add vbus and overcurrent gpios")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-06 16:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06 13:06 [PATCH] usb: ohci-da8xx: ensure error return on variable error is set Colin King
2020-01-06 13:06 ` Colin King
2020-01-06 16:06 ` Sergei Shtylyov
2020-01-06 16:06   ` Sergei Shtylyov

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.