if (ret)
goto err;
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
goto err;
}
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
if (ret)
goto err;
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
state->ber = (buf[2] << 16) | (buf[1] << 8) | buf[0];
state->ucblocks += (buf[4] << 8) | buf[3];
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
if (ret)
goto err;
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
}
state->snr = utmp * 10; /* dB/10 */
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
state->signal_strength = signal_strength;
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
c->frequency, c->bandwidth_hz);
/* program tuner */
- if (fe->ops.tuner_ops.set_params)
- fe->ops.tuner_ops.set_params(fe);
+ if (fe->ops.tuner_ops.set_params) {
+ ret = fe->ops.tuner_ops.set_params(fe);
+ if (ret)
+ goto err;
+ }
/* program CFOE coefficients */
if (c->bandwidth_hz != state->bandwidth_hz) {
}
/* Return an error if can't find bandwidth or the right clock */
- if (i == ARRAY_SIZE(coeff_lut))
- return -EINVAL;
+ if (i == ARRAY_SIZE(coeff_lut)) {
+ ret = -EINVAL;
+ goto err;
+ }
ret = regmap_bulk_write(state->regmap, 0xae00, coeff_lut[i].val,
sizeof(coeff_lut[i].val));
/* program frequency control */
if (c->bandwidth_hz != state->bandwidth_hz || state->first_tune) {
/* get used IF frequency */
- if (fe->ops.tuner_ops.get_if_frequency)
- fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency);
- else
+ if (fe->ops.tuner_ops.get_if_frequency) {
+ ret = fe->ops.tuner_ops.get_if_frequency(fe,
+ &if_frequency);
+ if (ret)
+ goto err;
+ } else {
if_frequency = state->if_frequency;
+ }
dev_dbg(&client->dev, "if_frequency %u\n", if_frequency);
state->set_frontend_jiffies = jiffies;
state->first_tune = false;
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
break;
}
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
state->fe_status = *status;
state->read_status_jiffies = jiffies;
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
state->first_tune = true;
schedule_delayed_work(&state->statistics_work, msecs_to_jiffies(400));
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
if (ret)
goto err;
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
state->i2c_gate_state = enable;
- return ret;
+ return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
static int af9013_download_firmware(struct af9013_state *state)
{
struct i2c_client *client = state->client;
- int i, len, remaining, ret;
+ int ret, i, len, remaining;
unsigned int utmp;
const struct firmware *fw;
u16 checksum = 0;
ret = regmap_read(state->regmap, 0x98be, &utmp);
if (ret)
goto err;
- else
- dev_dbg(&client->dev, "firmware status %02x\n", utmp);
+
+ dev_dbg(&client->dev, "firmware status %02x\n", utmp);
if (utmp == 0x0c) /* fw is running, no need for download */
- goto exit;
+ return 0;
dev_info(&client->dev, "found a '%s' in cold state, will try to load a firmware\n",
af9013_ops.info.name);
sizeof(fw_params));
if (ret)
- goto err_release;
+ goto err_release_firmware;
#define FW_ADDR 0x5100 /* firmware start address */
#define LEN_MAX 16 /* max packet size */
if (ret) {
dev_err(&client->dev, "firmware download failed %d\n",
ret);
- goto err_release;
+ goto err_release_firmware;
}
}
+ release_firmware(fw);
+
/* request boot firmware */
ret = regmap_write(state->regmap, 0xe205, 0x01);
if (ret)
- goto err_release;
+ goto err;
/* Check firmware status. 0c=OK, 04=fail */
ret = regmap_read_poll_timeout(state->regmap, 0x98be, utmp,
(utmp == 0x0c || utmp == 0x04),
5000, 1000000);
if (ret)
- goto err_release;
+ goto err;
dev_dbg(&client->dev, "firmware status %02x\n", utmp);
if (utmp == 0x04) {
- dev_err(&client->dev, "firmware did not run\n");
ret = -ENODEV;
+ dev_err(&client->dev, "firmware did not run\n");
+ goto err;
} else if (utmp != 0x0c) {
- dev_err(&client->dev, "firmware boot timeout\n");
ret = -ENODEV;
+ dev_err(&client->dev, "firmware boot timeout\n");
+ goto err;
}
-err_release:
+ dev_info(&client->dev, "found a '%s' in warm state\n",
+ af9013_ops.info.name);
+
+ return 0;
+err_release_firmware:
release_firmware(fw);
err:
-exit:
- if (!ret)
- dev_info(&client->dev, "found a '%s' in warm state\n",
- af9013_ops.info.name);
+ dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
}