• Martin Wache's avatar
    [media] dib7000p: avoid division by zero · 5332b626
    Martin Wache authored
    dib7000p_read_word() may return zero on i2c errors, resulting in
    dib7000p_get_internal_freq() returning zero.
    So don't divide by the result of dib7000p_get_internal_freq()
    without checking it for zero in dib7000p_set_dds().
    
    On one of my machines the device
    ID 2304:0229 Pinnacle Systems, Inc. PCTV Dual DVB-T 2001e
    about once a day/every two days gets into a state, where
    most (all?) I2C reads return with an error. Tuning during this
    state will result in a divide by zero without this patch.
    This patch doesn't fix the root cause for the device getting
    into a bad state, but it allows me to unload/reload the drivers,
    bringing it back into a usable state.
    Signed-off-by: default avatarMartin Wache <M.Wache@gmx.net>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
    5332b626
dib7000p.c 74.1 KB