aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/tuners/tda18218.c
diff options
context:
space:
mode:
authorPaul Bolle <pebolle@tiscali.nl>2012-11-01 16:00:09 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-12-21 15:25:13 -0500
commited2e33011451f655052ff1d3aa9ee936057d508b (patch)
tree73a42c53539da33dc2c88bec6b012592c6c4cb65 /drivers/media/tuners/tda18218.c
parentcb31c7487580a0cfc6eb253e604c1e51ac8eb3c8 (diff)
[media] tda18212: tda18218: use 'val' if initialized
Commits e666a44fa313cb9329c0381ad02fc6ee1e21cb31 ("[media] tda18212: silence compiler warning") and e0e52d4e9f5bce7ea887027c127473eb654a5a04 ("[media] tda18218: silence compiler warning") silenced warnings equivalent to these: drivers/media/tuners/tda18212.c: In function ‘tda18212_attach’: drivers/media/tuners/tda18212.c:299:2: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/media/tuners/tda18218.c: In function ‘tda18218_attach’: drivers/media/tuners/tda18218.c:305:2: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized] But in both cases 'val' will still be used uninitialized if the calls of tda18212_rd_reg() or tda18218_rd_reg() fail. Fix this by only printing the "chip id" if the calls of those functions were successful. This allows to drop the uninitialized_var() stopgap measure. Also stop printing the return values of tda18212_rd_reg() or tda18218_rd_reg(), as these are not interesting. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Acked-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/tuners/tda18218.c')
-rw-r--r--drivers/media/tuners/tda18218.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/tuners/tda18218.c b/drivers/media/tuners/tda18218.c
index 18198537be9f..2d31aeb6b088 100644
--- a/drivers/media/tuners/tda18218.c
+++ b/drivers/media/tuners/tda18218.c
@@ -277,7 +277,7 @@ struct dvb_frontend *tda18218_attach(struct dvb_frontend *fe,
277 struct i2c_adapter *i2c, struct tda18218_config *cfg) 277 struct i2c_adapter *i2c, struct tda18218_config *cfg)
278{ 278{
279 struct tda18218_priv *priv = NULL; 279 struct tda18218_priv *priv = NULL;
280 u8 uninitialized_var(val); 280 u8 val;
281 int ret; 281 int ret;
282 /* chip default registers values */ 282 /* chip default registers values */
283 static u8 def_regs[] = { 283 static u8 def_regs[] = {
@@ -302,8 +302,8 @@ struct dvb_frontend *tda18218_attach(struct dvb_frontend *fe,
302 302
303 /* check if the tuner is there */ 303 /* check if the tuner is there */
304 ret = tda18218_rd_reg(priv, R00_ID, &val); 304 ret = tda18218_rd_reg(priv, R00_ID, &val);
305 dev_dbg(&priv->i2c->dev, "%s: ret=%d chip id=%02x\n", __func__, ret, 305 if (!ret)
306 val); 306 dev_dbg(&priv->i2c->dev, "%s: chip id=%02x\n", __func__, val);
307 if (ret || val != def_regs[R00_ID]) { 307 if (ret || val != def_regs[R00_ID]) {
308 kfree(priv); 308 kfree(priv);
309 return NULL; 309 return NULL;