From patchwork Tue Sep 9 12:36:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 387312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-pa0-x240.google.com (mail-pa0-x240.google.com [IPv6:2607:f8b0:400e:c03::240]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 06780140095 for ; Tue, 9 Sep 2014 22:37:16 +1000 (EST) Received: by mail-pa0-f64.google.com with SMTP id lf10sf417146pab.9 for ; Tue, 09 Sep 2014 05:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=yRAbHL4atghbyU/cM9I+1jocwnt4XwwKmwfRm9PvSpQ=; b=duHRCOwxRpqaL09981O0l0+URfGxaqkA0FLHsKekUn+tbGiIJD3g1pu/KwZ+9p4nhL oPDx4DmrwFJes9y+bgPiSGFZBRoExEOb53IENVYEXD6OaeKHAmDca2TIQl8HvCuO61Av +RSGjg8rs5zxcreW4mvQhT0RXOmSyc437Mfz/SGhKSM5CaKH4ABoPTPmU2bUc0IM2s6X /jJyFtB4PZotGQb6We5BhMTKYU8eSduzzwqkAN4zXTjcbb6CDnYUGsjdBC2o897e0Vka LOEkPCd9Wg58gKT7qYrZqp9ySTxLMM8gqGQbFKtvv08+IKmgb9Up/NSiBK7hEUK79APR nV1Q== X-Received: by 10.140.83.180 with SMTP id j49mr773031qgd.1.1410266234748; Tue, 09 Sep 2014 05:37:14 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.140.94.73 with SMTP id f67ls1517334qge.61.gmail; Tue, 09 Sep 2014 05:37:14 -0700 (PDT) X-Received: by 10.236.148.2 with SMTP id u2mr834231yhj.55.1410266234462; Tue, 09 Sep 2014 05:37:14 -0700 (PDT) Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.17.24]) by gmr-mx.google.com with ESMTPS id pz1si78906pbb.0.2014.09.09.05.37.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Sep 2014 05:37:14 -0700 (PDT) Received-SPF: none (google.com: arnd@arndb.de does not designate permitted sender hosts) client-ip=212.227.17.24; Received: from wuerfel.localnet (HSI-KBW-134-3-133-35.hsi14.kabel-badenwuerttemberg.de [134.3.133.35]) by mrelayeu.kundenserver.de (node=mreue102) with ESMTP (Nemesis) id 0MhlTv-1XmyNG3udP-00MvoC; Tue, 09 Sep 2014 14:36:34 +0200 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Sergei Shtylyov , Alessandro Zummo , linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com Subject: [rtc-linux] [PATCH v3 1/2] rtc: pcf8563: fix uninitialized use warning Date: Tue, 09 Sep 2014 14:36:30 +0200 Message-ID: <19416272.eCNUZ3hTWV@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <540DCEB0.6030108@cogentembedded.com> References: <2750370.rlMuFcoBUA@wuerfel> <540DCEB0.6030108@cogentembedded.com> MIME-Version: 1.0 X-Provags-ID: V02:K0:SF7J1OFxCT/OyuB/bk9mLH8OeM7mtmpMowzwmUhmOdp IkszEO1iW3YL82qbazc/HNT2bJGlPerBdnhyx0QSoLuHML7xB+ y4ENDnVe5/vYSzScJoJ8KekzszhAn60YgyEVhQrmBW4a50tECi sNYBjsFspJj6Nt/AC6YdowOLBZsqntqkWkESSv2Wa1oXrTfRUQ Da45bwtbJJVT+Qpa5FjfuWkrLjVEibvJTLzbAaQXpW/c3Cg/3m 69vkmv0t4XZaZEhGU568/0YtbD9g40DnLDscvhFNnmgYAV23AF 0sLBVt9VxMGMUIR+AFTGDLaHTPnuw8cou4juzPCI3HyaQvzwye upRKLYqvj9BH6Ab8iDeA= X-UI-Out-Filterresults: notjunk:1; X-Original-Sender: arnd@arndb.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: arnd@arndb.de does not designate permitted sender hosts) smtp.mail=arnd@arndb.de Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , gcc-4.9 found a potential condition under which the 'pending' variable may be used uninitialized: drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_irq': drivers/rtc/rtc-pcf8563.c:173:5: warning: 'pending' may be used uninitialized in this function [-Wmaybe-uninitialized] This is because in the pcf8563_get_alarm_mode() function, we check any nonzero return of pcf8563_read_block_data, but in the irq function we only check for negative values, so a possible positive value does not get detected if the compiler chooses not to inline the entire call chain. Checking for any non-zero value in the interrupt handler as well is just as correct and lets the compiler know what we are doing, without needing a bogus initialization. Signed-off-by: Arnd Bergmann diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index 5a197d9dc7e7..3a6f994c4da8 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c @@ -167,7 +167,7 @@ static irqreturn_t pcf8563_irq(int irq, void *dev_id) char pending; err = pcf8563_get_alarm_mode(pcf8563->client, NULL, &pending); - if (err < 0) + if (err) return err; if (pending) {