From patchwork Thu Jul 23 07:37:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11680261 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 00982618 for ; Thu, 23 Jul 2020 07:39:36 +0000 (UTC) Received: by mail.kernel.org (Postfix) id EC50B20714; Thu, 23 Jul 2020 07:39:36 +0000 (UTC) Delivered-To: soc@kernel.org Received: from kozik-lap.mshome.net (unknown [194.230.155.213]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2333E20888; Thu, 23 Jul 2020 07:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595489976; bh=Q+VpYpLjWIwZ0g8o4mw+vEngonlHZ5dsYcy1gteiV5w=; h=From:List-Id:To:Cc:Subject:Date:In-Reply-To:References:From; b=fEBDmx/81iUUTlDt+yRSihyz14ccJ3hurkzqj3rShk1Az4IuFlr6Vqze8o8ZbMzdH hJA7yHBIVT11ow5yNFwciEqwZTI/V8BFtIhYs5bpm08zQEyqhiJ+I3yV34H7CktEpI YYOepVrrOkkt1+dVza4c2U+8d/FQxJZOkqpV8NfE= From: Krzysztof Kozlowski List-Id: To: Arnd Bergmann , Olof Johansson , arm@kernel.org, soc@kernel.org, Krzysztof Kozlowski , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Florian Fainelli , Santosh Shilimkar , Matthias Brugger , Roger Quadros , Tony Lindgren , Vladimir Zapolskiy , Thierry Reding , Jonathan Hunter , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-omap@vger.kernel.org, linux-tegra@vger.kernel.org Cc: Andrew Morton , Linus Torvalds , Greg Kroah-Hartman Subject: [PATCH 19/23] memory: omap-gpmc: Enclose macro statements in do-while Date: Thu, 23 Jul 2020 09:37:40 +0200 Message-Id: <20200723073744.13400-20-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200723073744.13400-1-krzk@kernel.org> References: <20200723073744.13400-1-krzk@kernel.org> do-while is a preferred way for complex macros because of safety reasons. This fixes checkpatch error: ERROR: Macros starting with if should be enclosed by a do - while loop to avoid possible if/else logic defects Signed-off-by: Krzysztof Kozlowski --- drivers/memory/omap-gpmc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index c158b6cae9a9..bb85aa56d247 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -635,10 +635,12 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, int max return 0; } -#define GPMC_SET_ONE_CD_MAX(reg, st, end, max, field, cd) \ - if (set_gpmc_timing_reg(cs, (reg), (st), (end), (max), \ - t->field, (cd), #field) < 0) \ - return -1 +#define GPMC_SET_ONE_CD_MAX(reg, st, end, max, field, cd) \ + do { \ + if (set_gpmc_timing_reg(cs, (reg), (st), (end), (max), \ + t->field, (cd), #field) < 0) \ + return -1; \ + } while (0) #define GPMC_SET_ONE(reg, st, end, field) \ GPMC_SET_ONE_CD_MAX(reg, st, end, 0, field, GPMC_CD_FCLK)