diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/frontends/tda1004x.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index 3993d1ce334a..a0d638653567 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c | |||
@@ -1248,7 +1248,7 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, | |||
1248 | struct i2c_adapter* i2c) | 1248 | struct i2c_adapter* i2c) |
1249 | { | 1249 | { |
1250 | struct tda1004x_state *state; | 1250 | struct tda1004x_state *state; |
1251 | u8 id; | 1251 | int id; |
1252 | 1252 | ||
1253 | /* allocate memory for the internal state */ | 1253 | /* allocate memory for the internal state */ |
1254 | state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); | 1254 | state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); |
@@ -1264,6 +1264,12 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, | |||
1264 | 1264 | ||
1265 | /* check if the demod is there */ | 1265 | /* check if the demod is there */ |
1266 | id = tda1004x_read_byte(state, TDA1004X_CHIPID); | 1266 | id = tda1004x_read_byte(state, TDA1004X_CHIPID); |
1267 | if (id < 0) { | ||
1268 | printk(KERN_ERR "tda10045: chip is not answering. Giving up.\n"); | ||
1269 | kfree(state); | ||
1270 | return NULL; | ||
1271 | } | ||
1272 | |||
1267 | if (id != 0x25) { | 1273 | if (id != 0x25) { |
1268 | printk(KERN_ERR "Invalid tda1004x ID = 0x%02x. Can't proceed\n", id); | 1274 | printk(KERN_ERR "Invalid tda1004x ID = 0x%02x. Can't proceed\n", id); |
1269 | kfree(state); | 1275 | kfree(state); |
@@ -1312,7 +1318,7 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, | |||
1312 | struct i2c_adapter* i2c) | 1318 | struct i2c_adapter* i2c) |
1313 | { | 1319 | { |
1314 | struct tda1004x_state *state; | 1320 | struct tda1004x_state *state; |
1315 | u8 id; | 1321 | int id; |
1316 | 1322 | ||
1317 | /* allocate memory for the internal state */ | 1323 | /* allocate memory for the internal state */ |
1318 | state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); | 1324 | state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); |
@@ -1328,6 +1334,11 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, | |||
1328 | 1334 | ||
1329 | /* check if the demod is there */ | 1335 | /* check if the demod is there */ |
1330 | id = tda1004x_read_byte(state, TDA1004X_CHIPID); | 1336 | id = tda1004x_read_byte(state, TDA1004X_CHIPID); |
1337 | if (id < 0) { | ||
1338 | printk(KERN_ERR "tda10046: chip is not answering. Giving up.\n"); | ||
1339 | kfree(state); | ||
1340 | return NULL; | ||
1341 | } | ||
1331 | if (id != 0x46) { | 1342 | if (id != 0x46) { |
1332 | printk(KERN_ERR "Invalid tda1004x ID = 0x%02x. Can't proceed\n", id); | 1343 | printk(KERN_ERR "Invalid tda1004x ID = 0x%02x. Can't proceed\n", id); |
1333 | kfree(state); | 1344 | kfree(state); |