From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751905AbdINLHs (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 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.9.0