Instead of crash, return -ENODEV, if the device is not poperly
initialized.
Also, give a second chance for it to initialize, at set_params
calls.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
struct mt2063_state {
struct i2c_adapter *i2c;
+ bool init;
+
const struct mt2063_config *config;
struct dvb_tuner_ops ops;
struct dvb_frontend *frontend;
if (status < 0)
return status;
+ state->init = true;
+
return 0;
}
dprintk(2, "\n");
+ if (!state->init)
+ return -ENODEV;
+
*tuner_status = 0;
status = mt2063_lockStatus(state);
if (status < 0)
dprintk(2, "\n");
+ if (!state->init) {
+ status = mt2063_init(fe);
+ if (status < 0)
+ return status;
+ }
+
switch (params->mode) {
case V4L2_TUNER_RADIO:
pict_car = 38900000;
s32 if_mid;
s32 rcvr_mode;
+ if (!state->init) {
+ status = mt2063_init(fe);
+ if (status < 0)
+ return status;
+ }
+
dprintk(2, "\n");
if (c->bandwidth_hz == 0)
dprintk(2, "\n");
+ if (!state->init)
+ return -ENODEV;
+
*freq = state->frequency;
return 0;
}
dprintk(2, "\n");
+ if (!state->init)
+ return -ENODEV;
+
*bw = state->AS_Data.f_out_bw - 750000;
return 0;
}