]> git.hungrycats.org Git - linux/commitdiff
usbcore: Fix wrong device in an error message in hub_port_connect()
authorTakashi Iwai <tiwai@suse.de>
Tue, 19 Aug 2014 15:37:55 +0000 (17:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Sep 2014 23:36:42 +0000 (16:36 -0700)
commit dd5f5006d1035547559c8a90781a7e249787a7a2 upstream.

The commit [5ee0f803cc3a: usbcore: don't log on consecutive debounce
failures of the same port] added the check of the reliable port, but
it also replaced the device argument to dev_err() wrongly, which leads
to a NULL dereference.

This patch restores the right device, port_dev->dev.  Also, since
dev_err() itself shows the port number, reduce the port number shown
in the error message, essentially reverting to the state before the
commit 5ee0f803cc3a.

[The fix suggested by Hannes, and the error message cleanup suggested
 by Alan Stern]

Fixes: 5ee0f803cc3a ('usbcore: don't log on consecutive debounce failures of the same port')
Reported-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hub.c

index 7d0518f08876c02dab4cd66daef6de035403f163..247df0e8173c7ba9ad3e2c40c2a4c411f097a7c5 100644 (file)
@@ -4619,9 +4619,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
                        if (status != -ENODEV &&
                                port1 != unreliable_port &&
                                printk_ratelimit())
-                               dev_err(&udev->dev, "connect-debounce failed, port %d disabled\n",
-                                       port1);
-
+                               dev_err(&port_dev->dev, "connect-debounce failed\n");
                        portstatus &= ~USB_PORT_STAT_CONNECTION;
                        unreliable_port = port1;
                } else {