From patchwork Tue Aug 31 06:48:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 12466517 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65D47C432BE for ; Tue, 31 Aug 2021 06:51:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 30852603E7 for ; Tue, 31 Aug 2021 06:51:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 30852603E7 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=bzAmnWODmi0zbGix2M3SYsn1+sPqOGz3nNOPcQXIUsA=; b=2WKlEnWIcGVYih sVhm4OifDtiUKLwCTAtszogkozSRoZiQqXyFTdMg4HbQ5ArgF5ohCUpRrC4TLkfqieCF4ekzeUKjh daIMpUqU1zkUBjduRbqEz2XNs7+blUNmfQvGWKfYHPWfVfFdkfaGomsYUyBKAOUH8K+4mR4BX2/Io if87D9nDrI23xJHl05KoA1AT8ccMeIHR/5H41i0lILTN+6YbqHzHnQnmACLp0mpYfF1b4diiv73h+ LXul3rziS+0clZIic0Gy4d1vwzFi28yFkzl+bybaevfeJZ8TjL7Ww9FRHj2l5t/M6LXe/ukppMIfh iRBCuUxwAP6M2paQTrMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKxaL-001Tnj-EU; Tue, 31 Aug 2021 06:49:29 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKxaE-001TmX-OO for linux-arm-kernel@lists.infradead.org; Tue, 31 Aug 2021 06:49:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1630392562; x=1661928562; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JTAKNwf9/VDIV8aG/1dqbq8tyWYJ42As+VykpPbner0=; b=gGVXUoe3X181zJt+Dy5FoN7z9vvOzPFLgFSdyeYXQyctjglH2OZzSZBH Xz9oiddAzS1Ln1GvtmrN13sU1iXKljdwjmi03bIiRnYq23toPtwEsyAcj vuJdQ3A9G/9dVttQEg3K/5+RieITjflJKZE2vigLlgZAaajNwilNyvUTs QPbldNiCxdpwa6na9D2hs8df/kiqwS14eoUYuuFFXIV0Jc1WA5eMWAJ8u aVv4ODoV0litU5tVd2wizrKrQ+W0R4mn2qy5cumKy/d0rMSiOSMpx0m2s WEgh2TsdKIgyz63AfmiGfP7YZM7PKd+HIu/HlGzlqj2oaK5x4K7LQ/z9k Q==; IronPort-SDR: 8JOg7j2LcHXqiYgjLCi7asyQmhpshlu1XaIHM4LcWlsS1kyO5q7PikOs3TrNKXDMaYI9lV76TT fIXZPkF7KIQVswCUMzOo5C2wxSa1EPDErLl14vuKjT2ZEILk4ZKY0Z6ggDIanZxhy+DnRGnCLs 0pThhaPMq0a+TaxVshGoXiTvUnft1qeSTEFKebcH7LpK8TLURRbR5GExqB4Np2m6f1gY+I9w0B PGYDBDI+e7cKpy6I8Vj8rQqjHfX1ztDa5pO6BbiikpQrydQvSvzejQzanFszf7Zg643iUSC/Fx tFdFPErVXKk4jwCsGiQK6FT/ X-IronPort-AV: E=Sophos;i="5.84,365,1620716400"; d="scan'208";a="134242849" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 30 Aug 2021 23:49:21 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 30 Aug 2021 23:49:20 -0700 Received: from ROB-ULT-M18282.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 30 Aug 2021 23:49:16 -0700 From: Eugen Hristev To: CC: , , , Eugen Hristev , kernel test robot Subject: [PATCH] iio: adc: at91-sama5d2_adc: fix warning for uninitialized 'val' variable Date: Tue, 31 Aug 2021 09:48:00 +0300 Message-ID: <20210831064800.78979-1-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210830_234922_847757_8E05DDA6 X-CRM114-Status: GOOD ( 11.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org >> drivers/iio/adc/at91-sama5d2_adc.c:722:11: warning: variable 'val' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] else if (reg == st->soc_info.platform->layout->YPOSR) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iio/adc/at91-sama5d2_adc.c:725:7: note: uninitialized use occurs here if (!val) ^~~ drivers/iio/adc/at91-sama5d2_adc.c:722:7: note: remove the 'if' if its condition is always true else if (reg == st->soc_info.platform->layout->YPOSR) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iio/adc/at91-sama5d2_adc.c:711:9: note: initialize the variable 'val' to silence this warning u32 val; ^ = 0 1 warning generated. Fixed by initializing 'val' variable. Fixes: 29edec2b98ff ("iio: adc: at91-sama5d2_adc: convert to platform specific data structures") Reported-by: kernel test robot Signed-off-by: Eugen Hristev --- Hi Jonathan, If you can still rebase your testing branch, maybe you can squash this into the original patch, no need to make a separate commit I guess. I fixed this as soon as the report came out from the 0day robot. Thanks ! Eugen drivers/iio/adc/at91-sama5d2_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 29c7441f9f27..f8a9ad50a00b 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -846,7 +846,7 @@ static int at91_adc_configure_touch(struct at91_adc_state *st, bool state) static u16 at91_adc_touch_pos(struct at91_adc_state *st, int reg) { - u32 val; + u32 val = 0; u32 scale, result, pos; /*