aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-08-03 16:46:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-04 08:50:07 -0400
commitbb9bd878089f365729b9c54012671d289a9a1952 (patch)
tree45c7d1976d88819928efca772a3ec0abf1ada29c /drivers/media/dvb-frontends
parent774e0362b20b3e09ed3e63f88bce72a0bdb0a975 (diff)
drivers/media/dvb-frontends/cxd2841er.c: avoid misleading gcc warning
The addition of jump label support in dynamic_debug caused an unexpected warning in exactly one file in the kernel: drivers/media/dvb-frontends/cxd2841er.c: In function 'cxd2841er_tune_tc': include/linux/dynamic_debug.h:134:3: error: 'carrier_offset' may be used uninitialized in this function [-Werror=maybe-uninitialized] __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~~~~~~~~~~~~~~~ drivers/media/dvb-frontends/cxd2841er.c:3177:11: note: 'carrier_offset' was declared here int ret, carrier_offset; ^~~~~~~~~~~~~~ The problem seems to be that the compiler gets confused by the extra conditionals in static_branch_unlikely, to the point where it can no longer keep track of which branches have already been taken, and it doesn't realize that this variable is now always initialized when it gets used. I have done lots of randconfig kernel builds and could not find any other file with this behavior, so I assume it's a rare enough glitch that we don't need to change the jump label support but instead just work around the warning in the driver. To achieve that, I'm moving the check for the return value into the switch() statement, which is an obvious transformation, but is enough to un-confuse the compiler here. The resulting code is not as nice to read, but at least we retain the behavior of warning if it gets changed to actually access an uninitialized carrier offset value in the future. Link: http://lkml.kernel.org/r/20160713204342.1221511-1-arnd@arndb.de Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Abylay Ospan <aospan@netup.ru> Cc: Sergey Kozlov <serjk@netup.ru> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Jason Baron <jbaron@akamai.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/media/dvb-frontends')
-rw-r--r--drivers/media/dvb-frontends/cxd2841er.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c
index 09c39346167f..ffe88bc6b813 100644
--- a/drivers/media/dvb-frontends/cxd2841er.c
+++ b/drivers/media/dvb-frontends/cxd2841er.c
@@ -3378,20 +3378,28 @@ static int cxd2841er_tune_tc(struct dvb_frontend *fe,
3378 ret = cxd2841er_get_carrier_offset_i( 3378 ret = cxd2841er_get_carrier_offset_i(
3379 priv, p->bandwidth_hz, 3379 priv, p->bandwidth_hz,
3380 &carrier_offset); 3380 &carrier_offset);
3381 if (ret)
3382 return ret;
3381 break; 3383 break;
3382 case SYS_DVBT: 3384 case SYS_DVBT:
3383 ret = cxd2841er_get_carrier_offset_t( 3385 ret = cxd2841er_get_carrier_offset_t(
3384 priv, p->bandwidth_hz, 3386 priv, p->bandwidth_hz,
3385 &carrier_offset); 3387 &carrier_offset);
3388 if (ret)
3389 return ret;
3386 break; 3390 break;
3387 case SYS_DVBT2: 3391 case SYS_DVBT2:
3388 ret = cxd2841er_get_carrier_offset_t2( 3392 ret = cxd2841er_get_carrier_offset_t2(
3389 priv, p->bandwidth_hz, 3393 priv, p->bandwidth_hz,
3390 &carrier_offset); 3394 &carrier_offset);
3395 if (ret)
3396 return ret;
3391 break; 3397 break;
3392 case SYS_DVBC_ANNEX_A: 3398 case SYS_DVBC_ANNEX_A:
3393 ret = cxd2841er_get_carrier_offset_c( 3399 ret = cxd2841er_get_carrier_offset_c(
3394 priv, &carrier_offset); 3400 priv, &carrier_offset);
3401 if (ret)
3402 return ret;
3395 break; 3403 break;
3396 default: 3404 default:
3397 dev_dbg(&priv->i2c->dev, 3405 dev_dbg(&priv->i2c->dev,
@@ -3399,8 +3407,6 @@ static int cxd2841er_tune_tc(struct dvb_frontend *fe,
3399 __func__, priv->system); 3407 __func__, priv->system);
3400 return -EINVAL; 3408 return -EINVAL;
3401 } 3409 }
3402 if (ret)
3403 return ret;
3404 dev_dbg(&priv->i2c->dev, "%s(): carrier offset %d\n", 3410 dev_dbg(&priv->i2c->dev, "%s(): carrier offset %d\n",
3405 __func__, carrier_offset); 3411 __func__, carrier_offset);
3406 p->frequency += carrier_offset; 3412 p->frequency += carrier_offset;