diff mbox

[v2,2/2] usb: gadget: pxa27x: Test for a valid argument pointer

Message ID e794578c-8805-691f-27bc-f07880013fa1@tul.cz (mailing list archive)
State New, archived
Headers show

Commit Message

Petr Cvek Feb. 24, 2017, 1:54 a.m. UTC
A call usb_put_phy(udc->transceiver) must be tested for a valid pointer.
Use an already existing test for usb_unregister_notifier call.

Reported-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 drivers/usb/gadget/udc/pxa27x_udc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Robert Jarzmik Feb. 25, 2017, 12:24 p.m. UTC | #1
Petr Cvek <petr.cvek@tul.cz> writes:

> A call usb_put_phy(udc->transceiver) must be tested for a valid pointer.
> Use an already existing test for usb_unregister_notifier call.
>
> Reported-by: Robert Jarzmik <robert.jarzmik@free.fr>
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>

Cheers.
diff mbox

Patch

diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 821bd8f4cae6..d48e239660c3 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -2531,9 +2531,10 @@  static int pxa_udc_remove(struct platform_device *_dev)
 	usb_del_gadget_udc(&udc->gadget);
 	pxa_cleanup_debugfs(udc);
 
-	if (!IS_ERR_OR_NULL(udc->transceiver))
+	if (!IS_ERR_OR_NULL(udc->transceiver)) {
 		usb_unregister_notifier(udc->transceiver, &pxa27x_udc_phy);
-	usb_put_phy(udc->transceiver);
+		usb_put_phy(udc->transceiver);
+	}
 
 	udc->transceiver = NULL;
 	the_controller = NULL;