From patchwork Thu Sep 14 11:07:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9952853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 616F460230 for ; Thu, 14 Sep 2017 11:08:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 228BB28E92 for ; Thu, 14 Sep 2017 11:08:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 155B328EB1; Thu, 14 Sep 2017 11:08:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B15428E92 for ; Thu, 14 Sep 2017 11:08:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751424AbdINLHs (ORCPT ); Thu, 14 Sep 2017 07:07:48 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:54249 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751413AbdINLHq (ORCPT ); Thu, 14 Sep 2017 07:07:46 -0400 Received: from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0LZqH7-1d9kEs112r-00lntY; Thu, 14 Sep 2017 13:07:35 +0200 From: Arnd Bergmann To: Ramesh Shanmugasundaram , Mauro Carvalho Chehab Cc: Arnd Bergmann , Hans Verkuil , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] rcar_drif: fix potential uninitialized variable use Date: Thu, 14 Sep 2017 13:07:27 +0200 Message-Id: <20170914110733.3592437-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:QLXhlsDhx9RvT6PvTfgzwZNTSn81PQw7QRj5sRJ5e0RNOTO7dd1 cMhKQE0G3Sji8dR7Mz/uhKdGW/GbePuwqwELGt0beTCK6uBmnSNbjTldXXpITJEuJnWvE05 vBxaQc56EyzIYIlaHmzl+4CiPVAUHTnnVbGDya/sVFX0IPOyPAnciq3qD0BTrChxCBYpYsu k5pqXHNuyafjfeZ35ZRHA== X-UI-Out-Filterresults: notjunk:1; V01:K0:xddQl4lvQ44=:UF9sLbm2AglC16p5cGSk7E wmqlExnG6zh+CemLOAZ5adtuABHXo4OKl2OWpTT+maqwWm56gr4KCBiunycazpaYiRf4C/ECd KbWMcSDe+oOz8olTjdKzWNT1h96a+OgqB/PmauPKFM4BaiB8YBG9DFpPtYc4J0oOoQH8kQTEn 0eTgf15e26LZwVCJCtmQtjcUG8LKLKcXUpXolDZ8YLAdaTzpcpEmXbuQweNbAiL9xhfZmz7Js hyF7huuFkXiKXNnV53oZC0dtS06xwr9n+0UCXEQFKvDdyY6iZXrjCWGBgPPv37VDWa8b/evx2 PPtgwj3DK74Z4fpijoTdunWV10N/VQ+V89DDKOD7YG7HZpRsfuIA/16wqc6+1vInsO+J27T0f gwH0BmQu3NfZ4iepG65/8+lrJl9iTljWiPy7s1XGuu/3cAOVOvsYSg0gcB2oZrjQ3/CdidcI/ +UlHSl5Zl990cWCKRUGmKPPt5KpKk/GRb2XmPhvDAmSpV/FZ1SySWvNd8NBCQ1UH/Oly3Msop iRGCQIzPC1p2AeWIdMNQH2YmKt5G/E8/YcOmvMiKiWzTolzfD6507wwjgMAUK8MhZzuRm7cS7 jE9EFvJatcOpUS4p1roQ9oARe1clAN2dtYWB6TjZME22LU63fVeUJK72m38WLDPckjgi5PB6Z oqqbFPN67WzI2YaKr0rVw1/LtotDfXp8Nbi7PB3h5yarR3ijYO3cpaR3PJwK8XYctj8fIM9SA i44kxUZIETGHNWS7m0mUxGyeYp1XyVpX3Mtb5c8vyywi7wUZNxs+nRqNOKs= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Older compilers like gcc-4.6 may run into a case that returns an uninitialized variable from rcar_drif_enable_rx() if that function was ever called with an empty cur_ch_mask: drivers/media/platform/rcar_drif.c:658:2: error: ‘ret’ may be used uninitialized in this function [-Werror=uninitialized] Newer compilers don't have that problem as they optimize the 'ret' variable away and just return zero in that case. This changes the function to return -EINVAL for this particular failure, to make it consistent across all compiler versions. In case gcc gets changed to report a warning for it in the future, it's also a good idea to shut it up now. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82203 Signed-off-by: Arnd Bergmann --- drivers/media/platform/rcar_drif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c index 522364ff0d5d..2c6afd38b78a 100644 --- a/drivers/media/platform/rcar_drif.c +++ b/drivers/media/platform/rcar_drif.c @@ -630,7 +630,7 @@ static int rcar_drif_enable_rx(struct rcar_drif_sdr *sdr) { unsigned int i; u32 ctr; - int ret; + int ret = -EINVAL; /* * When both internal channels are enabled, they can be synchronized