Skip to content

Commit ba9b408

Browse files
Colin Ian Kinggregkh
authored andcommitted
usb: ohci-da8xx: ensure error return on variable error is set
Currently when an error occurs when calling devm_gpiod_get_optional or calling gpiod_to_irq it causes an uninitialized error return in variable 'error' to be returned. Fix this by ensuring the error variable is set from da8xx_ohci->oc_gpio and oc_irq. Thanks to Dan Carpenter for spotting the uninitialized error in the gpiod_to_irq failure case. Addresses-Coverity: ("Uninitialized scalar variable") Fixes: d193abf ("usb: ohci-da8xx: add vbus and overcurrent gpios") Signed-off-by: Colin Ian King <[email protected]> Cc: stable <[email protected]> Acked-by: Alan Stern <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 96a0c12 commit ba9b408

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/usb/host/ohci-da8xx.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,17 @@ static int ohci_da8xx_probe(struct platform_device *pdev)
415415
}
416416

417417
da8xx_ohci->oc_gpio = devm_gpiod_get_optional(dev, "oc", GPIOD_IN);
418-
if (IS_ERR(da8xx_ohci->oc_gpio))
418+
if (IS_ERR(da8xx_ohci->oc_gpio)) {
419+
error = PTR_ERR(da8xx_ohci->oc_gpio);
419420
goto err;
421+
}
420422

421423
if (da8xx_ohci->oc_gpio) {
422424
oc_irq = gpiod_to_irq(da8xx_ohci->oc_gpio);
423-
if (oc_irq < 0)
425+
if (oc_irq < 0) {
426+
error = oc_irq;
424427
goto err;
428+
}
425429

426430
error = devm_request_threaded_irq(dev, oc_irq, NULL,
427431
ohci_da8xx_oc_thread, IRQF_TRIGGER_RISING |

0 commit comments

Comments
 (0)