• Arnd Bergmann's avatar
    rt2x00: convert rt2800_rfcsr_read return type · 16d571bb
    Arnd Bergmann authored
    With CONFIG_KASAN enabled and gcc-7, we get a warning about rather high
    stack usage (with a private patch set I have to turn on this warning,
    which I intend to get into the next kernel release):
    
    wireless/ralink/rt2x00/rt2800lib.c: In function 'rt2800_bw_filter_calibration':
    wireless/ralink/rt2x00/rt2800lib.c:7990:1: error: the frame size of 2144 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
    
    The problem is that KASAN inserts a redzone around each local variable
    that gets passed by reference, and the newly added function has a lot
    of them.
    
    This is a semi-automated conversion to change rt2800_rfcsr_read to return
    the register contents instead of passing them by value, resulting in
    much better object code. The majority of the patch was done using:
    
    sed -i 's:\(rt2800_rfcsr_read(.*, .*\), &\(.*\));:\2 = \1);:' \
        -i 's:\(rt2800_rfcsr_read_bank(.*, .*\), &\(.*\));:\2 = \1);:' \
            drivers/net/wireless/ralink/rt2x00/rt2800lib.c
    
    Fixes: 41977e86 ("rt2x00: add support for MT7620")
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
    16d571bb
rt2800lib.c 303 KB