From patchwork Mon Mar 8 09:03:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 12121819 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=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 B1DBEC433DB for ; Mon, 8 Mar 2021 09:04:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8801A65202 for ; Mon, 8 Mar 2021 09:04:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230113AbhCHJDv (ORCPT ); Mon, 8 Mar 2021 04:03:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbhCHJDp (ORCPT ); Mon, 8 Mar 2021 04:03:45 -0500 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EAE1C06174A; Mon, 8 Mar 2021 01:03:44 -0800 (PST) Received: by mail-lj1-x235.google.com with SMTP id t9so15087754ljt.8; Mon, 08 Mar 2021 01:03:44 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=BB78i/TOrdtbQgIIMS5144s3mE6rskxVn8XRXaD3Po0=; b=unSEgdNsO1ZS1AOfxEfdlbhZxdoZDrxS7aH36MTZ/KfZkdnmNg1MnzbIJD5E2BVSC1 vy5Fh1ZXZGaD2wpSM616BISiaz8KLnWJHHGwC603poxTZeDve4lv9ZnUWvGEK6hoy/we rcsInr8pjkBbZtCBiXOxS4xEGk/ZMwhb/EWQZbjohF/sBUhxzTSPR9JutKdCRTG5ZCIz d4/aYGDZ6U5wwqeAaW545aQW5Y1jSflWKlVGCuOj7YPSiiwCvNXMmjMXp9gQ+EhDvaXf l89UMnAy6M7QOxsSpiZWLyvpZ36WDNGh+g5QA9Y+K3Xr5uR2zpqGz37SZhQy6ZAXbCJ7 LSfw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=BB78i/TOrdtbQgIIMS5144s3mE6rskxVn8XRXaD3Po0=; b=nQ5TNgtIrvImyU1mJNQ9NgfoHGuNBcl6uygOVgbg9LXo+rEB25ziaOjVDMxy51ET97 a4KpAXnKVUkHZ9l6rWGjdJC5DfR5etgs2g56roMWz7R4cQHgBMxGK5RWWVi36HKenqmk 92jQ+6ucGjKsj1o0CVXekmXEeNznAyfxs6KifpijYQzuYXwI0gDvJJg5nVrRfrSw7hfT GMGmyAgjqyCd3sFZnOFOPVwhSFS9yYjZWG6f85GYv2i4WkgZDwLXc7acEk4TntfwgYcN f64uHVdSXNG9/iTKecdtBvKPghsojX+cJg8y+utOfbGIrhIPQWIfUFqZD/AVQCR+JMfR Q2aA== X-Gm-Message-State: AOAM532TV+uiB+6UrOVgB1IS5W+i/xcIlzhMHuARjJSdBy8xb9iNXpdi Wb+Hyjp+fmEclnnBRxhCBlc= X-Google-Smtp-Source: ABdhPJyK7mQGyO2W7OgUqJ1I3bccbBt71tnUSxhtbuAwNi3kvGd13XX/UjUyaP8e1zUbhRjn1huGnw== X-Received: by 2002:a2e:b814:: with SMTP id u20mr13062565ljo.370.1615194223105; Mon, 08 Mar 2021 01:03:43 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id t13sm1410346ljk.47.2021.03.08.01.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 01:03:42 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, Florian Fainelli , Vivek Unune , bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?b?UmFm?= =?utf-8?b?YcWCIE1pxYJlY2tp?= Subject: [PATCH mips/linux.git 4/5] firmware: bcm47xx_nvram: look for NVRAM with for instead of while Date: Mon, 8 Mar 2021 10:03:19 +0100 Message-Id: <20210308090320.9765-5-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210308090320.9765-1-zajec5@gmail.com> References: <20210308090320.9765-1-zajec5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Rafał Miłecki This loop requires variable initialization, stop condition and post iteration increment. It's pretty much a for loop definition. Signed-off-by: Rafał Miłecki --- drivers/firmware/broadcom/bcm47xx_nvram.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/firmware/broadcom/bcm47xx_nvram.c b/drivers/firmware/broadcom/bcm47xx_nvram.c index 09f51b95849e..1d2271b1e07a 100644 --- a/drivers/firmware/broadcom/bcm47xx_nvram.c +++ b/drivers/firmware/broadcom/bcm47xx_nvram.c @@ -93,15 +93,13 @@ static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_siz } /* TODO: when nvram is on nand flash check for bad blocks first. */ - flash_size = FLASH_MIN; - while (flash_size <= res_size) { + for (flash_size = FLASH_MIN; flash_size <= res_size; flash_size <<= 1) { /* Windowed flash access */ size = find_nvram_size(flash_start + flash_size); if (size) { offset = flash_size - size; goto found; } - flash_size <<= 1; } /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */