From patchwork Wed Jul 13 20:42:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102024 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1191322qga; Wed, 13 Jul 2016 13:44:13 -0700 (PDT) X-Received: by 10.98.71.91 with SMTP id u88mr6709721pfa.145.1468442653520; Wed, 13 Jul 2016 13:44:13 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ys10si4538097pab.121.2016.07.13.13.44.13; Wed, 13 Jul 2016 13:44:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751247AbcGMUoI (ORCPT + 4 others); Wed, 13 Jul 2016 16:44:08 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:55127 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750975AbcGMUoG (ORCPT ); Wed, 13 Jul 2016 16:44:06 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue005) with ESMTPA (Nemesis) id 0Lkkvg-1an0KI1g3g-00aXer; Wed, 13 Jul 2016 22:43:50 +0200 From: Arnd Bergmann To: Sergey Kozlov , Abylay Ospan , Mauro Carvalho Chehab Cc: Jason Baron , Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] cxd2841er: avoid misleading gcc warning Date: Wed, 13 Jul 2016 22:42:33 +0200 Message-Id: <20160713204342.1221511-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:n9loNeZAzgydHLWDgdtWQv3DFhPfXqdtC7m54SGqyYTPDZuJ0sv 0zVDVz1QgYhifQuKMwekuDU4eiTpnIWXwsbFlGgBeX15fRCvMjXzJyJttL5ntw5wbhKgvPJ sT4eOtpTqOXAsoQp/R98tYw7wvpQZBGrZHIRCVPqVu3mK63BvWBazbpfRVaIwJ1jWNDE83s NUI5JDbubBfEy8kJPAoZg== X-UI-Out-Filterresults: notjunk:1; V01:K0:0GiK7Qz04hw=:ef2qwNhYA9eNeukxHChYaY /osu8rMIgU9x+j8p4wsYwPqeJehbAbJWzhCUEPUCbF6FI6oSA1G0/Xy+7mrGAv/mKsRqz3qtj 4GJ9x9YWIgSsKxUGBhreqiMDbFfQ25l5mRxeDPPPPq+B+uDXf2VMbn+ZIAQZ+C7pqUT3lKxiV yi7HYbZEIvPdWvcO+NJHUz4Q2O29G0XTc9ryKPFPArQ0/R/8mlZbVh64lIfrR0ToYbVbzLh/w vnoUMgLGJ36bzx4awBTtFyibgDf94N+yKS0QDepnKq8nrRq2xPoTEkvpDbvE1SELtEpAENk9Q 6y2N/wZHGciSKrkwZfN0s+7AkD/5bA2AOGmWNYbpFlkfRxacztLKk7P0C+LaREsammHVsbScK h9UR0UsMGtaGA6F8WSH5kgQxeZ1slX2JlrEU3lEPZl/C0UzAmLvDLYxQ+hef7ybj8j6gRxC2m w2+assX9en11pvDCwmaXu5SCFkmrU42ax86GTRcigE+hal0wj7Q6Wnd0hpx3ZWziJOc/L7fY1 mMe8hitqqEcidg1fNzivQ9UPP/+W9gNLVVNfba2lC5vpRVYdmXpivfcVoF7t1I5XyKDEY2xig PL0WLyNpMQIk64v9sLG/c84FELnEq7I5EWsh4XFb1wXmWZNuKR+zR1G2S6yjPg6hyq12fPr3o +9vCRCTq6Qllkydf8pxmvAKdrmM6RzHKvJLxJijHnW3hq0YVmnewkfWT1jaReDRhM6Io= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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. Signed-off-by: Arnd Bergmann Fixes: (in linux-mm) "dynamic_debug: add jump label support" --- drivers/media/dvb-frontends/cxd2841er.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index 721fb074da7c..0639ca281a2c 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -3223,20 +3223,28 @@ static int cxd2841er_tune_tc(struct dvb_frontend *fe, ret = cxd2841er_get_carrier_offset_i( priv, p->bandwidth_hz, &carrier_offset); + if (ret) + return ret; break; case SYS_DVBT: ret = cxd2841er_get_carrier_offset_t( priv, p->bandwidth_hz, &carrier_offset); + if (ret) + return ret; break; case SYS_DVBT2: ret = cxd2841er_get_carrier_offset_t2( priv, p->bandwidth_hz, &carrier_offset); + if (ret) + return ret; break; case SYS_DVBC_ANNEX_A: ret = cxd2841er_get_carrier_offset_c( priv, &carrier_offset); + if (ret) + return ret; break; default: dev_dbg(&priv->i2c->dev, @@ -3244,8 +3252,6 @@ static int cxd2841er_tune_tc(struct dvb_frontend *fe, __func__, priv->system); return -EINVAL; } - if (ret) - return ret; dev_dbg(&priv->i2c->dev, "%s(): carrier offset %d\n", __func__, carrier_offset); p->frequency += carrier_offset;