host/ohci-tmio.c:104: possible novice coding error ?

2014-07-10 Thread David Binderman
Hello there,

[linux-3.16-rc4/drivers/usb/host/ohci-tmio.c:104]: (warning) Redundant bitwise 
operation on 'pm' in 'switch' statement. 'break;' missing?

switch (ohci-num_ports) {
default:
dev_err(dev-dev, Unsupported amount of ports: %d\n, 
ohci-num_ports);
case 3:
pm |= CCR_PM_USBPW3;
case 2:
pm |= CCR_PM_USBPW2;
case 1:
pm |= CCR_PM_USBPW1;
}

Suggest add missing breaks.

Regards

David Binderman


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


Re: host/ohci-tmio.c:104: possible novice coding error ?

2014-07-10 Thread Alan Stern
On Thu, 10 Jul 2014, David Binderman wrote:

 Hello there,
 
 [linux-3.16-rc4/drivers/usb/host/ohci-tmio.c:104]: (warning) Redundant 
 bitwise operation on 'pm' in 'switch' statement. 'break;' missing?
 
 switch (ohci-num_ports) {
 default:
 dev_err(dev-dev, Unsupported amount of ports: %d\n, 
 ohci-num_ports);
 case 3:
 pm |= CCR_PM_USBPW3;
 case 2:
 pm |= CCR_PM_USBPW2;
 case 1:
 pm |= CCR_PM_USBPW1;
 }
 
 Suggest add missing breaks.

Please don't; that would mess up the driver.  Instead, fix the
definition of CCR_PM_USBPW3.  I don't know what it should be, but right 
now it's equal to CCR_PM_USBPW2, which is obviously wrong.

Alan Stern

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


Re: host/ohci-tmio.c:104: possible novice coding error ?

2014-07-10 Thread Dmitry Eremin-Solenikov
Hello,

On Thu, Jul 10, 2014 at 7:53 PM, Alan Stern st...@rowland.harvard.edu wrote:
 On Thu, 10 Jul 2014, David Binderman wrote:

 Hello there,

 [linux-3.16-rc4/drivers/usb/host/ohci-tmio.c:104]: (warning) Redundant 
 bitwise operation on 'pm' in 'switch' statement. 'break;' missing?

 switch (ohci-num_ports) {
 default:
 dev_err(dev-dev, Unsupported amount of ports: %d\n, 
 ohci-num_ports);
 case 3:
 pm |= CCR_PM_USBPW3;
 case 2:
 pm |= CCR_PM_USBPW2;
 case 1:
 pm |= CCR_PM_USBPW1;
 }

 Suggest add missing breaks.

 Please don't; that would mess up the driver.  Instead, fix the
 definition of CCR_PM_USBPW3.  I don't know what it should be, but right
 now it's equal to CCR_PM_USBPW2, which is obviously wrong.

No, the breaks are omitted there on purpose. USBPW3 might be wrong.
I checked the specs, it should be 0x10 (I was not able to check it - my hardware
has only 2 usb ports). Please correct it if it is incorrect.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html