From patchwork Fri Jul 8 14:14:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2102 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id DDA823F081 for ; Fri, 8 Jul 2022 16:14:46 +0200 (CEST) Received: by mail-ej1-f69.google.com with SMTP id hq41-20020a1709073f2900b00722e5ad076csf5831680ejc.20 for ; Fri, 08 Jul 2022 07:14:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657289686; cv=pass; d=google.com; s=arc-20160816; b=NmsGVefY1ex28/5rFBfzg48GZWVjdASBHCpzzWpQcp1NVIDWcj95TDqb6FGelBDf7w whtaIWyaRqxTKRIbB5wJEzINk/rvtJw0e2JoOq0NEZH+PSBQBbkD50277OsW//uUlC5p +iDv/4Oo1s1T74mkArCm7ZGvezaDwWNsJbnwmljBObIPpYjgoUtIBFYE8x0WrvXIWO7m JI3EXjd25Fj0otz5DgTeq8QPcWhnDPQ15dw/JcdIPRsaaU1q7eOqGhulE5PQ5YeYzGi2 82HXtdSvAsIlc7HJ3WIaku2yZvz6mfxSv2YboK0pofBB7H3z82YuSEE5CcJtl7tuRKUQ Ha1Q== 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=gwkObwSp7vVwlfsYef5064Eaq3fcCOrLmgGEJnB9iOh9zksCrN95ZTWjhFyjMGPhrR iizdZjd/ukGv+36CTNipgDYaYnWBGvXCJvmUWXUdOHkcJzOPkNZmQegBcfKnIqvLi0Gb gewEBzI2+L5LLS1o7JWtyZilKXuikliL7mSsEVw4gyCtAvZ+P7UzPt/fvA9v0v972kVm uk2VZ/Eyx/aHAlrQtF+8qy7ElBbzzFD56lqz0EwCkFaoi2X1EOS9AMYrn0KEHgVb6der lXQenqMQ4sYc22yDTliUp5DMwen4bzYgsi5O1Nz86Ep3hm4CIzj2Cbq2BpVk5joyRkZq 2VGA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oEuVJkFe; 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=VC+HKSkTk7lzvZMDSHuuzhgWeWKhR/xKN5dEWOv6DeDdtwMoJY+ogFFuBO7w2VNZwi cp34kd8mt0wd9bNgN97pLQFwreFSFDjOn+nYVwdVo5YnnikF0hE16dazOOZ6ly490VeJ OlnShy0XzXTjIPyTUNfydH77xXKzpHHn6LeG4= 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=jJxdVDAHq5Pl/pSEPN5OkpBS+SFv1gHzJkjFr758ulhK5Lt+h4190l4I1itEVXBLPn hwtVmoqwFsTHy9xVC9KrED4Ggi6lKfm5V/VnT02cmpq4Z5hxCskhiwkwKdRNu0ACXLWg 8TO/25FdfcYmkaskebomb17QJvQYWKLdfxnUgJTrjsuganTV1rFqzW5l6KUuxo8Bawkk 1m+QYH0AhqZ9gsAmtXQthB9Awf3t/8v4Yp1ODEAVHwS6usx7Say19HXBT+nU6OnMD1EI uTrmdfRLWtSdgBJFOqD8mGN/s64zMpuzkGdeiCoUdi56u1+V2vUFsV7JG9dQWLueNgYA gZdA== X-Gm-Message-State: AJIora+gHjDq4Zv0OMvPhGNGPoPzXMFfKsSXaCvgmcG4FgkYg29WOlUU nyRCx56YP+yr3d7pj+Wrtgz6l9NA X-Google-Smtp-Source: AGRyM1tbK4TfS9lyBMFo5q5wFJLqsPip0fO0fpYdVC66/V0blGI+ov97W9/gvngGaVuocV489EuWZw== X-Received: by 2002:a05:6402:3785:b0:435:5d0e:2a2e with SMTP id et5-20020a056402378500b004355d0e2a2emr5274411edb.307.1657289686679; Fri, 08 Jul 2022 07:14:46 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:42c7:b0:43a:82dc:c2a2 with SMTP id i7-20020a05640242c700b0043a82dcc2a2ls240673edc.3.gmail; Fri, 08 Jul 2022 07:14:45 -0700 (PDT) X-Received: by 2002:a05:6402:1844:b0:43a:7c15:c626 with SMTP id v4-20020a056402184400b0043a7c15c626mr5216255edy.17.1657289685175; Fri, 08 Jul 2022 07:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657289685; cv=none; d=google.com; s=arc-20160816; b=nJV/fQEfOnZ1U4eW0xPDxLIhuvWpWYUH05MDRNGhNYHd/x1Qjsd+vNNyKsfAt3VbjW vpRSiNdTfm4NOMBw47+n8hHoAaGlJnRMEOad82aCpckQDgKf3OMQ3ZHrnJq1kzGkNGty sfUUybQKEMOlzUllMG4Lg+ZdkCfUONuiO7hhV5+RVsXQnPM3DQqfb121+SEtidzBgW/P P+7i7SlsbjERyyoUfqIkNs77JXv/Ae2YbFT28g66aqBzK6kjK/2jF8A/tZ2Z411wxhGs uMI+cA6fVNGR7BdMOATUhGNbuAA3Q0nfaQBzKHmHtlNhpRbfMIz7+FlCnzg+6prYWZT2 KInA== 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=refn3x7TCajxtVUJO1I1Toh7kVG1KuWBlgysxR+8neNEgPhBv+eq69/Q2loiiy31in Q+CoFHXZ7DSx9q5zbxPbytHPNer7pk+VA+Qtkjovt0oT3PWUc5gXolp8wdk2hJ5S2qbK T+N/j6JNzqUPwH4SFf0eV8sgKvG7haMXLmNTA79fee5V9VZZrGt1WZYvbakdGCvGHDZO iFGifzFlahRDK0jbPSrDDYoX4zW/JhTn8odn6N2etdBzzFawaiRsPUxLx5qEMuPSeLXo E68jRwiqYYmskB5I4MexSGh4wsZ+wroJLQreVoT764igTfD6bVzY/rFgmcoFKzaHSfqt CunA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oEuVJkFe; 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 sa25-20020a170906edb900b0072b130dbadcsor1656914ejb.114.2022.07.08.07.14.45 for (Google Transport Security); Fri, 08 Jul 2022 07:14:45 -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:dc93:b0:726:a75b:f60f with SMTP id cs19-20020a170906dc9300b00726a75bf60fmr3769606ejc.564.1657289684498; Fri, 08 Jul 2022 07:14:44 -0700 (PDT) Received: from panicking.amarulasolutions.com ([62.18.232.106]) by smtp.gmail.com with ESMTPSA id s3-20020a1709067b8300b0070efa110afcsm20419074ejo.83.2022.07.08.07.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 07:14:43 -0700 (PDT) From: Michael Trimarchi To: linux-amarula@amarulasolutions.com, Dario Binacchi , u-boot@lists.denx.de (open list) Cc: u-boot@lists.denx.de (open list) Subject: [PATCH 2/2] mtd: nand: mxs_nand_spl Fix loop exit condition Date: Fri, 8 Jul 2022 16:14:39 +0200 Message-Id: <20220708141439.164394-2-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220708141439.164394-1-michael@amarulasolutions.com> References: <20220708141439.164394-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=oEuVJkFe; 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) {