Skip to contentSkip to conversation

Missing break in timedia serial setup.

PATCH Dave Jones 3 participants 6 messages Dec 7, 2005

lore
Share & tools
lore
#1 lore raw
Quoted 2 lines · Dave Jones

Spotted during code review by a Fedora user.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=174967

Makes no difference.

        switch (idx) {
        case 3:
                bar = 1;
        case 4: /* BAR 2 */
        case 5: /* BAR 3 */
        case 6: /* BAR 4 */
        case 7: /* BAR 5 */
                bar = idx - 2;

If idx is 3, idx - 2 is 1. So the bar = 1 is actually redundant in case 3.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
author
#2 lore raw
Quoted 15 lines · Russell King
Quoted 2 lines · Dave Jones

Spotted during code review by a Fedora user.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=174967

Makes no difference.

        switch (idx) {
        case 3:
                bar = 1;
        case 4: /* BAR 2 */
        case 5: /* BAR 3 */
        case 6: /* BAR 4 */
        case 7: /* BAR 5 */
                bar = idx - 2;
Quoted 2 lines

If idx is 3, idx - 2 is 1. So the bar = 1 is actually redundant in case 3.

Duh, yes of course. Here's a patch to remove the redundant assignment, but as it's harmless, I'll leave it up to you to decide whether or not it's worth applying.

drivers/serial/8250_pci.c renamed from drivers/serial/8250_pci.c~ +0 -1
@@ -516,7 +516,6 @@ pci_timedia_setup(struct serial_private 
 		break;
 	case 3:
 		offset = board->uart_offset;
-		bar = 1;
 	case 4: /* BAR 2 */
 	case 5: /* BAR 3 */
 	case 6: /* BAR 4 */
#3 lore raw
Quoted 7 lines

drivers/serial/8250_pci.c pci_timedia_setup(struct serial_private

Quoted 8 lines
drivers/serial/8250_pci.c renamed from drivers/serial/8250_pci.c~ +0 -2
@@ -516,7 +516,6 @@ pci_timedia_setup(struct serial_private 
 		break;
 	case 3:
 		offset = board->uart_offset;
-		bar = 1;
 	case 4: /* BAR 2 */
 	case 5: /* BAR 3 */
 	case 6: /* BAR 4 */
-

might as well add a /* fall through */ comment so that this doesn't come up again in the future..

author
#4 lore raw
Quoted 2 lines · Arjan van de Ven

might as well add a /* fall through */ comment so that this doesn't come up again in the future..

Remove redundant assignment, and mark fallthrough.

drivers/serial/8250_pci.c renamed from drivers/serial/8250_pci.c~ +1 -1
@@ -516,7 +516,7 @@ pci_timedia_setup(struct serial_private 
 		break;
 	case 3:
 		offset = board->uart_offset;
-		bar = 1;
+		/* FALLTHROUGH */
 	case 4: /* BAR 2 */
 	case 5: /* BAR 3 */
 	case 6: /* BAR 4 */
#5 lore raw
Quoted 6 lines · Dave Jones
Quoted 2 lines · Arjan van de Ven

might as well add a /* fall through */ comment so that this doesn't come up again in the future..

Remove redundant assignment, and mark fallthrough.

Thanks Dave, committed.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core