Bug 47681 - ath/ath5k/phy.c:1977: possible missing break ?
Summary: ath/ath5k/phy.c:1977: possible missing break ?
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: network-wireless (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: John W. Linville
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-18 20:04 UTC by David Binderman
Modified: 2012-10-16 13:35 UTC (History)
2 users (show)

See Also:
Kernel Version: 3.6-rc6
Subsystem:
Regression: No
Bisected commit-id:


Attachments
0001-ath5k-add-missing-breaks-in-ath5k_hw_set_spur_mitiga.patch (1.29 KB, patch)
2012-09-24 18:31 UTC, John W. Linville
Details | Diff

Description David Binderman 2012-09-18 20:04:27 UTC
I just ran the static analyser cppcheck over the source code of the
linux kernel version 3.6-rc6.

It said

[linux-3.6-rc6/drivers/net/wireless/ath/ath5k/phy.c:1977]: (warning) Redundant assignment of "symbol_width" in switch

The source code is

        case AR5K_BWMODE_10MHZ:
            /* Both sample_freq and chip_freq are 20MHz (?) */
            spur_delta_phase = (spur_offset << 18) / 25;
            spur_freq_sigma_delta = (spur_delta_phase >> 10);
            symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz / 2;
        case AR5K_BWMODE_5MHZ:
            /* Both sample_freq and chip_freq are 10MHz (?) */
            spur_delta_phase = (spur_offset << 19) / 25;
            spur_freq_sigma_delta = (spur_delta_phase >> 10);
            symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz / 4;
        default:

I agree with cppcheck, I think there are some missing break statements
in these cases.
Comment 1 John W. Linville 2012-09-24 18:31:43 UTC
Created attachment 80981 [details]
0001-ath5k-add-missing-breaks-in-ath5k_hw_set_spur_mitiga.patch

Looks like a second break was missing as well...
Comment 2 Florian Mickler 2012-10-15 21:27:48 UTC
A patch referencing this bug report has been merged in Linux v3.7-rc1:

commit 944f8a1a6f5ff8b503f3544811d0aa4ac27dd2aa
Author: John W. Linville <linville@tuxdriver.com>
Date:   Mon Sep 24 14:30:19 2012 -0400

    ath5k: add missing breaks in ath5k_hw_set_spur_mitigation_filter

Note You need to log in before you can comment on or make changes to this bug.