Re: [PATCH] usbcore: Fix wrong device in an error message in hub_port_connect()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Tue, 19 Aug 2014 10:35:58 -0400 (EDT),
Alan Stern wrote:
> 
> On Tue, 19 Aug 2014, Takashi Iwai wrote:
> 
> > 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.
> > 
> > [The fix suggested by Hannes]
> > 
> > Fixes: 5ee0f803cc3a ('usbcore: don't log on consecutive debounce failures of the same port')
> > Reported-by: Hannes Reinecke <hare@xxxxxxx>
> > Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
> > ---
> >  drivers/usb/core/hub.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> > index 8a4dcbc7a75f..22635590860c 100644
> > --- a/drivers/usb/core/hub.c
> > +++ b/drivers/usb/core/hub.c
> > @@ -4631,7 +4631,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",
> > +				dev_err(&port_dev->dev, "connect-debounce failed, port %d disabled\n",
> >  					port1);
> >  
> >  			portstatus &= ~USB_PORT_STAT_CONNECTION;
> 
> In fact, this looks like it might be a mistaken patch conflict 
> resolution.
> 
> Anyway, the proposed fix is redundant.  There's no need to mention the 
> port number in the error message, because the port number is already 
> part of the device name for port_dev->dev.  The statement should be:
> 
> +				dev_err(&port_dev->dev, "connect-debounce failed\n");
> 
> like it was before Oliver's patch.

Indeed...  Greg, let me know if I should respin the patch, or you
prefer applying more fix on the top.


thanks,

Takashi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux