Bug 44091

Summary: pch_uart.c:1265: possible missing break
Product: Drivers Reporter: David Binderman (dcb314)
Component: SerialAssignee: Alan (alan)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, florian
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.5-rc5 Subsystem:
Regression: No Bisected commit-id:

Description David Binderman 2012-07-01 15:05:37 UTC
I just ran the static analyser cppcheck over the source code of the
linux kernel version 3.5-rc5.

It said

[linux-3.5-rc5/drivers/tty/serial/pch_uart.c:1265]: (warning) Redundant assignment of "fifo_size" in switch

The source code is

    switch (priv->fifo_size) {
    case 256:
        fifo_size = PCH_UART_HAL_FIFO256;
        break;
    case 64:
        fifo_size = PCH_UART_HAL_FIFO64;
        break;
    case 16:
        fifo_size = PCH_UART_HAL_FIFO16;
    case 1:
    default:
        fifo_size = PCH_UART_HAL_FIFO_DIS;
        break;
    }

I think you might be better off with a break on the case 16.
Comment 1 Alan 2012-07-02 12:31:54 UTC
Patch queued
Comment 2 Florian Mickler 2012-08-04 19:11:34 UTC
A patch referencing this bug report has been merged in Linux v3.6-rc1:

commit 9bc03743fff0770dc5a5324ba92e67cc377f16ca
Author: Alan Cox <alan@linux.intel.com>
Date:   Mon Jul 2 18:51:38 2012 +0100

    pch_uart: Fix missing break for 16 byte fifo
Comment 3 Florian Mickler 2012-10-15 21:18:06 UTC
A patch referencing this bug report has been merged in Linux v3.7-rc1:

commit 669bd45f117cc8c7309acd6b6bb054fe4d9e46c0
Author: Alan Cox <alan@linux.intel.com>
Date:   Mon Jul 2 18:51:38 2012 +0100

    pch_uart: Fix missing break for 16 byte fifo