From patchwork Sun Sep 7 20:42:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 386742 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ee0-x240.google.com (mail-ee0-x240.google.com [IPv6:2a00:1450:4013:c00::240]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7DB7E14007B for ; Mon, 8 Sep 2014 06:43:33 +1000 (EST) Received: by mail-ee0-f64.google.com with SMTP id d49sf716111eek.19 for ; Sun, 07 Sep 2014 13:43:31 -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: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=xaIQp//QJE1hmCFia6E7SbhRL+Q5QoHbnFFxE+3qIv0lkSUzY1GaecQC91oUJq1BOh AWAE9hc7HWBZp7a7pbAB9nH9ayJgKYPAfa9lD9PVthSgOidJay4ucDC74Aiy79rS15Gg jirR1ojZzuUKdUFmctlt3QKhw6mgShpgEWbbAfwrMqE0O3/k17Vk0VvCjV65udKwb3rA 17hZZIL/ZfBzN9Iz5lgtfzIkNT/NHd3otLTx41/y9AeBF8EYOP/IBVMV+6EdWS8/XBn3 Rm1SQ6uCmhxa/9lZBKe04sG7AjsLTdEX4TlNJT4Wn4BieeZRotBkCF242/Or8N6/rCSN quQQ== X-Received: by 10.180.182.195 with SMTP id eg3mr76218wic.13.1410122611019; Sun, 07 Sep 2014 13:43:31 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.180.85.99 with SMTP id g3ls276103wiz.14.gmail; Sun, 07 Sep 2014 13:43:30 -0700 (PDT) X-Received: by 10.180.81.226 with SMTP id d2mr1475510wiy.5.1410122610328; Sun, 07 Sep 2014 13:43:30 -0700 (PDT) Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.17.13]) by gmr-mx.google.com with ESMTPS id pw5si1279725lbb.0.2014.09.07.13.43.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Sep 2014 13:43:30 -0700 (PDT) Received-SPF: none (google.com: arnd@arndb.de does not designate permitted sender hosts) client-ip=212.227.17.13; Received: from wuerfel.localnet (HSI-KBW-134-3-133-35.hsi14.kabel-badenwuerttemberg.de [134.3.133.35]) by mrelayeu.kundenserver.de (node=mreue101) with ESMTP (Nemesis) id 0MXpvr-1XvEif0fO3-00WqOG; Sun, 07 Sep 2014 22:42:46 +0200 From: Arnd Bergmann To: Alessandro Zummo Cc: rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [rtc-linux] [PATCH] rtc: pcf8563: fix uninitialized use warning Date: Sun, 07 Sep 2014 22:42:43 +0200 Message-ID: <3640058.m4Rfp1dmTJ@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V02:K0:vyIvX/pu5ooSPjgADPg8g+ryeGD9DlqJkLTz1fKjGPP ZTv5erWPLGlhbFXL+qnXJCLkn5bmvqeUOTu+MTjIbZqIJiaW0e LZXMnDNKGA3lVilkybmVsGnaQOW8cmhbfWrFT6f841yFtws3nQ E6kc84paCOqgFhsYMnuDMeo5OqGrEpaXLVVCXG2PIgzchINqZe bVIQUb4DaN+USRXbLSbAZIH5KUF3IOXEe9kAV6ENlIyoal+Enq Uc1HsOmCFF0obgMXjOlKpxA6MRuoQjwc//KHXVNUzQnHhFapSi Gxm4o8WfH3F21H3Ut0XPwnWCCW4Bhjo/RsFwdEIBGf8z+w5H82 kq//uQx4cOvQQ7VbJZQY= 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) {