From patchwork Fri Jul 8 09:54:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Nazzareno Trimarchi X-Patchwork-Id: 2099 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 447AE3F047 for ; Fri, 8 Jul 2022 11:55:05 +0200 (CEST) Received: by mail-ej1-f72.google.com with SMTP id l2-20020a170906078200b006fed42bfeacsf5542238ejc.16 for ; Fri, 08 Jul 2022 02:55:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657274105; cv=pass; d=google.com; s=arc-20160816; b=PhsefZ0R4n/WgLtC5uRoAJlVTbK2JaIWktFr7s6btK5BrWJVcr0hz7g1j2+ZM2Dk5E ZGYYl5Db8IpgXZjlIkp4YjcUbg3qChoQA2PdKSd6UUjH6qGvstzgUzJV49ESpMGCyBX9 4yHhdhP7zJFd+Va+JGaeOIU5hA2MRp4K0dPca75bT6W7iloQJeMfcw7l4Wx5iCpw+xHW 310rr9hVIS3YnmNyCL+NoEqeQ1JjpY8gkkY4YnXxrzOl1688nC3NWNNIvyoKXtC0ixQF xZOXGDIzGFnB40Zo3KVmCn+EIlW4Gf8t8RhpHRfGbF3yfMtDnw3t0sJUSADbMinWtH9f 5ZiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=UIl9iiO4djRyDq0NCMQbsJJhKKl4p/LrxD5YrJhi3XE=; b=hx4OfmZ+AljqkTIhNYWyh4nt4Def/7N+an/73lzZlTpNsAvVlwphpf8z+GZmHKrrFx /7vIywEZdFRkSwdiqtuZeAP76/Tr+2uvN7yFdbdhzyuI9E0BlQYX4//IQlrmqv9aKzW3 y7vfGGmIjSIzA/q8+KEoHYiYepFcEceCKCag0H79aNXV8gf/NUHBRCaBY7Oso268yb3C ja57DNxbvFEnW2CwhMFuzmQjdTuNiYF/1DUNleI7N6gBB5wJIevbnoA4+S4gbylsxXfj 3YWSGLM869gSBzyNLNHt3BUetSBT89ckhM6TCcLhTg/OWa2hPpljoLGoU30REZBeJd2q WynQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=czrJdVZ0; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=UIl9iiO4djRyDq0NCMQbsJJhKKl4p/LrxD5YrJhi3XE=; b=pT1Z0cG1+/87Fk0bcBn4grEwfXzZrmImaagR/nf4Yldv4Vr7FF+WSXRbpDEMehN0dq BKaV1orWUBVomKRu1cjNnNe1+j6T/9Dexwf82wHjO2gxECjGXaQwjxcVjEQOsrC+B0rQ rJT7UWI4x5XKjzJ1a45VBt/YacyLRAV+Y1LsU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=UIl9iiO4djRyDq0NCMQbsJJhKKl4p/LrxD5YrJhi3XE=; b=1zk7PEZBmNjmSrazDjtKERtY2lK5PqMIgqVMHAdDmqYR7P+CqgjYDYxQd5MM5vZQG3 9yzkn5mistdlf63i/zKbBZttRDc3a3xcSzqPSwZpDg6/5XvM1zyfp3pkwS5Dz0v2Hj57 ySGZVcrLzUmPHs8vF52NB3EhFqcDOg7SCFtgMSDhetYxui5CpBbIwdTxaWfb1B5nPy/U ejF6DJHwu6KKKB9Ta2v1gzQoLt8q182oeaX7Q62mVgAcAFIA6SVyFaJ/uO7DCFnEmGPj Medkp0RCan4LtPu1+Za1eeReN7nNFEsd3Wz7nWjlJNmn4LCZ83guWlTZmCIEjd8i2bcM cYkQ== X-Gm-Message-State: AJIora/Q7jvofQiO+Xzo0tPAAFBQb9ZBjZf+VJEYq+f4NY5mc3Noscsx k1nMcHYLR7Uu/1vIHXubkXe9JcoW X-Google-Smtp-Source: AGRyM1vsItqDkKYyHonh88fwkTAA798p4U8YjGCAkrvM1xYoJJAPaXqmy2bqF8GA+YFflWkZY57uiQ== X-Received: by 2002:a05:6402:5388:b0:435:71b:5d44 with SMTP id ew8-20020a056402538800b00435071b5d44mr3523184edb.364.1657274105096; Fri, 08 Jul 2022 02:55:05 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:2ad6:b0:6fe:976a:7a5 with SMTP id m22-20020a1709062ad600b006fe976a07a5ls546000eje.7.gmail; Fri, 08 Jul 2022 02:55:04 -0700 (PDT) X-Received: by 2002:a17:907:2cd3:b0:72a:b4a4:2fc4 with SMTP id hg19-20020a1709072cd300b0072ab4a42fc4mr2750279ejc.70.1657274103846; Fri, 08 Jul 2022 02:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657274103; cv=none; d=google.com; s=arc-20160816; b=VR7jKAZZ6Dv9HDdPuOOZa4gY3lBHFmLQtqlbIPXgaWQqAhY0asxgu51sDNpPDrilHQ TQX8ofd6HT1tQIoGpGnewOlUS9iIxcauBqA7cOOAFjh3JCMXEi3TZfNt8Q5tvMVryfc0 XmECe4msQbSWDr+DXgGbu488pbRU8CCydYeyHovy103ywFC1dzjhap1VTRT7j8yo9r96 P/PyKETJBvlayneLmNY8cjnVLlQIaqJ8wTPCwc1GHU0bzbGOY3XIsrzLLF4wZFxgrhbi GCmxAGxRV2rs+Tu9nD409tWdgxC8CZS2mAPzlniVqKhkqIykRMBv24RnWFt3qmaFsH8K CZ2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=noSRT8Q0yAZJZaXA/1jRBZjtJWtmRPAt4HnjHk6RmL0=; b=iTT35nCEkRdYzfEBZqNF2XXbq8Pk0pKNxIVrZuA6h9t0vLv4CbL/rqmxYTtuH5x93z qjQDoAWMBONnjENI1Po12f0Ei8zz1oj8+LjrURVfEFa8ZYvOq59ZS1inrRxMPgNy2IQt aJ3iIs2q4urZ0+sYUSvBNOs5CVyml30qcpoPX/F+g2OCJhSjRLmp83ZkGB1FhBfT36Ky XTmHR5suhPwB1aMYEz+EMMl+oZgzLsHbv9ClG8pSIlhRPNcaaQpHqM9RcPDb2jxHtHZT vnbYSujd6SyqbVyWHlImfrWCA3PG5aJRjg0FIdcC3+qvcnuaIcp3/pf1D3/HfaRwqstI nGrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=czrJdVZ0; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id kw26-20020a170907771a00b0072a9a56d2a1sor6367427ejc.129.2022.07.08.02.55.03 for (Google Transport Security); Fri, 08 Jul 2022 02:55:03 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:906:847a:b0:72b:1c75:1e69 with SMTP id hx26-20020a170906847a00b0072b1c751e69mr2700033ejc.153.1657274103451; Fri, 08 Jul 2022 02:55:03 -0700 (PDT) Received: from panicking.amarulasolutions.com ([62.18.232.106]) by smtp.gmail.com with ESMTPSA id m14-20020a1709061ece00b007121361d54asm20011230ejj.25.2022.07.08.02.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 02:55:02 -0700 (PDT) From: Michael Trimarchi To: Dario Binacchi Cc: linux-amarula@amarulasolutions.com Subject: [PATCH 2/2] mtd: nand: mxs_nand_spl Fix loop exit condition Date: Fri, 8 Jul 2022 11:54:54 +0200 Message-Id: <20220708095454.123808-2-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220708095454.123808-1-michael@amarulasolutions.com> References: <20220708095454.123808-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=czrJdVZ0; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , When size is 0 we need to stop the inner loop or we just waste time to load all the block of the eraseblock Signed-off-by: Michael Trimarchi --- drivers/mtd/nand/raw/mxs_nand_spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c index 683071c1cb..05886fa025 100644 --- a/drivers/mtd/nand/raw/mxs_nand_spl.c +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c @@ -263,7 +263,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst) while (block <= lastblock && size > 0) { if (!is_badblock(mtd, mtd->erasesize * block, 1)) { /* Skip bad blocks */ - while (page < nand_page_per_block) { + while (page < nand_page_per_block && size > 0) { int curr_page = nand_page_per_block * block + page; if (mxs_read_page_ecc(mtd, page_buf, curr_page) < 0) {