From patchwork Thu Mar 7 17:16:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10843469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 87F5D14DE for ; Thu, 7 Mar 2019 17:16:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64CA02F712 for ; Thu, 7 Mar 2019 17:16:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 587562F729; Thu, 7 Mar 2019 17:16:22 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 078EB2F712 for ; Thu, 7 Mar 2019 17:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject: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=jXb2LglEkYKoCu0VStX04ZDsY8kMVNPzkBtmbN4ru1E=; b=j9GffGiHvmrlAr T1Ql3WtJkthkfCJ5DmpS2Dsvp2pBLfeNjHXtVb5z8RZwK/EMQFQ7p7iAPpQ2NCoI51tdvGD9tqP2c 6wK2HkitZgq8YHtCiY8Ae0qRXZKlIAozvf4Dkjnq6oDM1FBbX/UBRj1UUIZB8ORPs8YkykFvQlkf5 YAXKeXKWK7AhEXBm1dwiXerK13ut7Vf9qM6xMzKMOfCJbr2m67H83LDE2LxRYkyjK0K4Klz5AucZQ D6rYigDevKzUtQ3V9BDLJN4D5oY1FoA5TCRYQZgdlB+J0UblN3XWkhSEcPOvbARVy90Q+VDwHk8g8 jepBQmtFdf9zu3kismyw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1wd2-0001Gc-EA; Thu, 07 Mar 2019 17:16:20 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1wcz-0001GC-U0 for linux-arm-kernel@lists.infradead.org; Thu, 07 Mar 2019 17:16:19 +0000 Received: by mail-ed1-x544.google.com with SMTP id x7so14115577eds.8 for ; Thu, 07 Mar 2019 09:16:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Q6MtqSnvkN42Z4rq12gEjJsLLTxX1BDFhkW479yq9mE=; b=OY5YaEU3lnNl1Qw5EhFInBU/GFJ4+QkrYkp62QOXXS1OStwktgfDC5kFk84WNFGgDF v0q11hMORc4bWWamYBAoclh6UfqldBGuxQVweWU+lcp6Lz+MuP9+QYpJLSsX9QZM2yFi EDIOH22s4Xvpyxo4jlNyPp/Jk81PV+Vjmv0+2TTSPsF3Wmu6hPiykNbxtebSAxO2eQ93 nE6KNCtx297wJmHfWgRJtzpHH/ZO5iM8tQjyMIfAnEVUj1Y1T+ON/Qfng7lXPG/bBw7I wUDHAHOA27q9k4yrf0DQKcfYxCCYLmduMikr3nplM6rL9nIF6SipE5A82tg/AWuEbAvu j95A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Q6MtqSnvkN42Z4rq12gEjJsLLTxX1BDFhkW479yq9mE=; b=ma04qmnDx+cZMjMVAaxo5c553jLTw9TWw+aGuPJu4TPMbnL1Mqf3PJ7nwHNQC7+a7/ /3Mxqp6Q5FFkNW4cGNyNQ7MefKdkwKhaUOdXdloXZYP6wKpFPy4NJQIgk9qOUoNMV5p/ Nf6FE/NyU6yUCXy6NMZ/0VHSTj7bqcibdqFr6oYRk8jzvre8Nzmm4WI0EvhdIyrNtXcA jHbIGD605zyCQOhvKVrG+bAEgOZGLqcfeqHfQMVWY/2ve9XQuK6KxLmrw04GktTqRLip Al5iK1/+UnEUukqLYs//VWq/MbC8UO9bG6ias3PBn2XR7LCad/2QCGtWEiFOw4lMYRMI FnNA== X-Gm-Message-State: APjAAAWsTCQ6PIhDfUh7COtnCt+/RQDyqtxtdNDysnQv6VzR+v0RGxEi S3S1DC9Ll0C99JmRAss1mLg= X-Google-Smtp-Source: APXvYqx03/jTxe3alHOPP6+eOYIoxkrPdaREM7KE06BhTI9bfNRMgqApnRYtVPwC4IxdGgC+X3Y8Lw== X-Received: by 2002:a50:b16e:: with SMTP id l43mr27589347edd.99.1551978975997; Thu, 07 Mar 2019 09:16:15 -0800 (PST) Received: from localhost.localdomain ([2a01:4f9:2a:1fae::2]) by smtp.gmail.com with ESMTPSA id v13sm1470608edm.73.2019.03.07.09.16.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:16:15 -0800 (PST) From: Nathan Chancellor To: Jonathan Cameron , Lee Jones Subject: [PATCH] iio: adc: stmpe-adc: Shuffle an if statement around in stmpe_adc_isr Date: Thu, 7 Mar 2019 10:16:04 -0700 Message-Id: <20190307171604.27791-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190307_091617_966357_31C502DA X-CRM114-Status: GOOD ( 12.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Krummenacher , Lars-Peter Clausen , Alexandre Torgue , clang-built-linux@googlegroups.com, linux-iio@vger.kernel.org, Peter Meerwald-Stadler , Nick Desaulniers , linux-kernel@vger.kernel.org, Stefan Agner , Philippe Schenker , Maxime Coquelin , Hartmut Knaack , Nathan Chancellor , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When building with -Wsometimes-uninitialized, Clang warns: drivers/iio/adc/stmpe-adc.c:204:13: warning: variable 'data' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] Clang can't tell that data will never be used uninitialized because the two if statements take care of all cases. Remove the first if statement and make it the else branch of the second one so that it is apparent to Clang that all cases are covered. Link: https://github.com/ClangBuiltLinux/linux/issues/387 Suggested-by: Nick Desaulniers Signed-off-by: Nathan Chancellor Reviewed-by: NIck Desaulniers --- drivers/iio/adc/stmpe-adc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c index 37f4b74a5d32..7921f827c6ec 100644 --- a/drivers/iio/adc/stmpe-adc.c +++ b/drivers/iio/adc/stmpe-adc.c @@ -184,9 +184,6 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id) struct stmpe_adc *info = (struct stmpe_adc *)dev_id; u16 data; - if (info->channel > STMPE_TEMP_CHANNEL) - return IRQ_NONE; - if (info->channel <= STMPE_ADC_LAST_NR) { int int_sta; @@ -205,6 +202,8 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id) /* Read value */ stmpe_block_read(info->stmpe, STMPE_REG_TEMP_DATA, 2, (u8 *) &data); + } else { + return IRQ_NONE; } info->value = (u32) be16_to_cpu(data);