media: mxl111sf: improve error handling logic
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 1 Nov 2017 21:05:54 +0000 (17:05 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 11 Dec 2017 18:14:44 +0000 (13:14 -0500)
As reported by smatch:
drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c:485 mxl111sf_demod_read_signal_strength() error: uninitialized symbol 'modulation'.

The mxl111sf_demod_read_signal_strength() just ignores if something
gets wrong while reading snr or modulation.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c

index f0ed37da73d42798fe9e028d1005180022c23742..221cf46b4140a336f6848bcda9bd595bd8e1ab90 100644 (file)
@@ -477,10 +477,15 @@ static int mxl111sf_demod_read_signal_strength(struct dvb_frontend *fe,
 {
        struct mxl111sf_demod_state *state = fe->demodulator_priv;
        enum fe_modulation modulation;
+       int ret;
        u16 snr;
 
-       mxl111sf_demod_calc_snr(state, &snr);
-       mxl1x1sf_demod_get_tps_modulation(state, &modulation);
+       ret = mxl111sf_demod_calc_snr(state, &snr);
+       if (ret < 0)
+               return ret;
+       ret = mxl1x1sf_demod_get_tps_modulation(state, &modulation);
+       if (ret < 0)
+               return ret;
 
        switch (modulation) {
        case QPSK: