RE: [PATCH] USB: OHCI: fix bad #define in ohci-tmio.c

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

 



Hello there,

----------------------------------------
> An incorrect definition of CCR_PM_USBPW3 in ohci-tmio.c is a perennial
> source of invalid diagnoses from static scanners, such as in
> <http://marc.info/?l=linux-usb&m=143634574527641&w=2>. This patch
> fixes the definition.

Sure the patch changes the value of one of the macros used in the switch statement,
but the code still has fallthrough from one case to another. That's
what the static analyser is complaining about, not the values of the macros.

I''m not sure if this fallthrough is intentional or not. 

If it is, it might be better etiquette to have a comment nearby with the word "fallthrough" in it,
to give the rest of us a clue as to the code's intention.

Something like
       case 3:
            pm |= CCR_PM_USBPW3;
            /* fallthrough */
       case 2:
            pm |= CCR_PM_USBPW2;
            /* fallthrough */
       case 1:
            pm |= CCR_PM_USBPW1;
            /* fallthrough */
On the other hand, if someone has blundered, and so the fallthrough is unintended,
then I'd expect to see code something like this:

       case 3:
            
                 pm |= CCR_PM_USBPW3;
                 break;
       case 2:
            
                 pm |= CCR_PM_USBPW2;
                 break;         
       case 1:
            
                 pm |= CCR_PM_USBPW1;
                 break;

Just an idea.

Regards

David Binderman

 		 	   		  --
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