media: radio: wl1273: add check on core->write() return value
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Thu, 22 Jun 2017 04:01:22 +0000 (01:01 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sat, 24 Jun 2017 12:38:14 +0000 (09:38 -0300)
Check return value from call to core->write(), so in case of
error print error message, jump to goto label fail and eventually
return.

Addresses-Coverity-ID: 1226943

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/radio/radio-wl1273.c

index 7240223dc15abae5a9dd00cf6662beaec8e2f196..17e82a9a01099bf6cc5f01b2ce4ab08a0f6b23a8 100644 (file)
@@ -610,10 +610,21 @@ static int wl1273_fm_start(struct wl1273_device *radio, int new_mode)
                        }
                }
 
-               if (radio->rds_on)
+               if (radio->rds_on) {
                        r = core->write(core, WL1273_RDS_DATA_ENB, 1);
-               else
+                       if (r) {
+                               dev_err(dev, "%s: RDS_DATA_ENB ON fails\n",
+                                       __func__);
+                               goto fail;
+                       }
+               } else {
                        r = core->write(core, WL1273_RDS_DATA_ENB, 0);
+                       if (r) {
+                               dev_err(dev, "%s: RDS_DATA_ENB OFF fails\n",
+                                       __func__);
+                               goto fail;
+                       }
+               }
        } else {
                dev_warn(dev, "%s: Illegal mode.\n", __func__);
        }