• Mauro Carvalho Chehab's avatar
    media: mb86a16: avoid division by zero · f303810c
    Mauro Carvalho Chehab authored
    As warned by smatch:
    	drivers/media/dvb-frontends/mb86a16.c:1690 mb86a16_read_ber() error: uninitialized symbol 'timer'.
    	drivers/media/dvb-frontends/mb86a16.c:1706 mb86a16_read_ber() error: uninitialized symbol 'timer'.
    
    There is a potential risk of doing a division by zero if
    timer is not handled well. Enforce it by setting a bit mask
    for the values used to select the timer.
    
    It should be noticed that I don't have mb86a16 datasheet. So,
    the bitmask was guessed based on the existing checks for
    the field. At worse case scenario, it will just show a
    badly calculated bit error rate, but it won't crash.
    
    While here, optimize the logic to prevent uneeded tests.
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
    f303810c
mb86a16.c 45.7 KB