From patchwork Thu Dec 10 15:40:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 11965181 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=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 AB20EC433FE for ; Thu, 10 Dec 2020 15:41:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 2CF9623770 for ; Thu, 10 Dec 2020 15:41:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CF9623770 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=web.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Date:Message-ID:Subject:From:To: 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=CjqSWLI7KLpMx0RLZKPiDaQHciXRBRLDZypcipvhC1w=; b=UimJ/pFXz0dcqnLzZRwmf+xogQ PDOe7iva/+kPi24vT9WpCDoqF3r/4fHKDP412sCQp4LVKtK/TFDyme/ASPJR/T5wAu2z6GW2WoM9V KzST4fBE+4UR7g79e8YzQ3LMypwmh3XQK7+hxBIsR7x+wecwKi3Um2IaRjzbl9kytA4y23Phnfbv1 se+9ajPWSNEo9I9YBC/wJjGyspCJaZeOO5L+g6d/lSsEtFEt7YH2kxhcra5WQVMyNHdFQqa094yRZ 8usDqg1JvVFNPQipDdShrQIzJa8CrjoA6xyK7YyvPaVsnyTpWjVVkR9GxxGmaTUqXQYueY+9PmJhH D4F3OXMA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knO3X-00071y-6N; Thu, 10 Dec 2020 15:40:35 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knO3V-00071c-1o for linux-arm-kernel@merlin.infradead.org; Thu, 10 Dec 2020 15:40:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Date:Message-ID:Subject:From:Cc:To:Sender:Reply-To:Content-ID: Content-Description:In-Reply-To:References; bh=aPxQblykblOcdl/qC/2GqEUMQH5rgbDDiPN76JHRvjM=; b=bu69BdIFNlHuznz93iuW68urf9 PD8OTNvon+I49xzwtx1uqpD+RYcB4Vj+MCi8vmgp37qw5+Piy6TpDQxTeMfgfNVK6YEwTwnZgrKyc UvscoCUbQkkBiQNnSomPUnXpumhUBzxzgqhLouNFbARFe4cStyuGrxcAf59yBel5bW3PcojOvoJVT c+HrnFEaW+xL0VIzn5QZVuwhyWVYEdkHnsaDG4vmr0sk8P6YMvh5/dAyymmm1lZaR2KrVqovK/mSt gbPZibusIjIYd3hS3RasaudEHKEenL8On2geuKUmeYJ4bhkEqBXtLnuXfZQeKMbXqF8AWHqLzh1vM 9h8NtsEg==; Received: from mout.web.de ([217.72.192.78]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knO3R-0007mb-LR for linux-arm-kernel@lists.infradead.org; Thu, 10 Dec 2020 15:40:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1607614823; bh=b/uWqoBxdXb1USFFeiC43glmd96IQvAhY6bQ8RQS+kM=; h=X-UI-Sender-Class:To:Cc:From:Subject:Date; b=IOeOelTLjxICqqD6XteGHQmnlB0je7xmi0Uq81mKrKxdEMu/6/4tD91ogXFW87KzO dhxfw+OxCN9yUP6R/ueuDmjb/O5O5GpN98XGtPP+CTXvLAfgajS9TzR0KBAM61Ezpi LN/woaEgEHuL1nPe81gdd3oFQ0MHClAvPilcWHD4= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [192.168.1.2] ([78.48.143.229]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MeBHO-1kU6Lw3vpu-00Pwjf; Thu, 10 Dec 2020 16:40:23 +0100 To: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Linus Walleij , Mark Brown From: Markus Elfring Subject: =?utf-8?q?=5BPATCH=5D_spi=3A_pl022=3A_Reduce_scope_for_the_variable?= =?utf-8?q?_=E2=80=9Cprevious=E2=80=9D_in_pump=5Ftransfers=28=29?= Message-ID: Date: Thu, 10 Dec 2020 16:40:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K1:fmuMNgSiSqulwZYN/Xrw9nztyFqufegGTuBn0fhNSyg43kkx0ye voI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i/0zB8EijeizMa18Ve1kpaGmMP2hRiS7L iVPwSzZfpw+z3soLC0Kg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_154030_064905_2BD90A3F X-CRM114-Status: GOOD ( 10.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, LKML Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Markus Elfring Date: Thu, 10 Dec 2020 16:31:00 +0100 A local variable was used only within an if branch. Thus move the definition for the variable “previous” into the corresponding code block. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/spi/spi-pl022.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.29.2 diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index d1776fea287e..469d8e8b286c 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -1381,7 +1381,6 @@ static void pump_transfers(unsigned long data) struct pl022 *pl022 = (struct pl022 *) data; struct spi_message *message = NULL; struct spi_transfer *transfer = NULL; - struct spi_transfer *previous = NULL; /* Get current state information */ message = pl022->cur_msg; @@ -1403,9 +1402,9 @@ static void pump_transfers(unsigned long data) /* Delay if requested at end of transfer before CS change */ if (message->state == STATE_RUNNING) { - previous = list_entry(transfer->transfer_list.prev, - struct spi_transfer, - transfer_list); + struct spi_transfer *previous = list_entry(transfer->transfer_list.prev, + struct spi_transfer, + transfer_list); /* * FIXME: This runs in interrupt context. * Is this really smart?