From patchwork Wed Jul 27 09:37:47 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: 2266 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2CB573F1F7 for ; Wed, 27 Jul 2022 11:38:02 +0200 (CEST) Received: by mail-ej1-f71.google.com with SMTP id sc42-20020a1709078a2a00b0072b5f51a9dbsf4917586ejc.1 for ; Wed, 27 Jul 2022 02:38:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658914682; cv=pass; d=google.com; s=arc-20160816; b=IC6m9/xCsR1wDcRX/iLbqMfCAKus/XxOYzp7NRn1V8TCiUB16kiUCUFQ3lTHTD1+Zb BP97bxe309FxD3llt3v5XK9UrRL2ieSW5weKWnflunkd3rJF8+AhF3QyiXk3ewsdoVeW mOTz3laBqo2eE13zqu0moggszvIFtjOrAb3V2ucuFp3fAml72QCJ6NZfk3W5jLYJ1y3q IiYF+2XVVv0m6Erpz8v+mmY0+qmk1anNpQVCU0ToNTp+0lrrmUUzaOf7YKpakttT5ibB pm5FX1Biziq0dz2g77pqVCGqAN03TKCir6VmKmRih7xAf1bUqpYNwRp/olXFm/YTiLaz RtWg== 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:to:from:dkim-signature; bh=br1mcQycVJoLCck3UiyyTozvRH410Qsu7npSSDXy79M=; b=Gb+J+JeFqlEvKJtxLOjiK+wVnL9/JGsV1FiBgWqPmjBz5cmnAHwe7NakfEYSpUIYsG NLD3l7KntWGWk3ZsQgx0q0+GzkwdH1kh0L/4A+EFAgWOh9Inip8ob7EefTwrB/wJ7DcT i5lFlgpT+PH6eL05KSM8OOk1Pxmjz55NCuJxcTQfpEvwg33YRqriBfSEBpl4e97+Q0Qk QZbkLHGh+VGLHUbQLcNj65iTrTb65EoyK6S2YA55urcBpuDjqPawOnRKf2RQ73/okn8y ObVxkiIPrJ+NshY5j8LtzE3ok/zJdsqqRqnHD/8zckS0Br1fCEjHQtjsC2cKVzjYL9ZV dPVA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=COBy4SME; 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: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=br1mcQycVJoLCck3UiyyTozvRH410Qsu7npSSDXy79M=; b=UgAfNqoZyhbXEpdvXqN5aigSODZMpXNX3YC7CGNajEIN8awsXlE79GLPlUQ21DChmm 4zJs2Pzjt7JORCmxldLhb5yJg7qPzzgWUu/ZYXzzq3XoduermpWbFpmL4SwRU1WzlYB3 hheABP27yiBkwilMO3QS4MaZW05/fYYL8DM1M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to: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=br1mcQycVJoLCck3UiyyTozvRH410Qsu7npSSDXy79M=; b=UouJrsRCwXr6oXdDx35UAhJDFrTbHX1jwDEcg93jdA02XOBTGwoKFwq3X1xkuxie+x AcunGjqc7uVtEeXhB61t+7OW0fwi0uprFC6h4Mxb5O8pujy/+qkhrPmfDqoA1FcWeeaq peWfm7VuE1XUCxkmxeXMilaz0s5IaU11Hd2dIk0CtoUiPwTn+P9feS0eAtzVwGcLoRny 3tqTv4TrjNY4FSp5k6GGlYLOSEavgJUAhOGKPHMmTRZOZ90i1Zb7ftVYYCoTUo9LreRE QpA8ymdV8OMFS1asfTNJJi0bfohB9ZZsfamKwpa+9gO28FgeNK8ODEHugOdm8s0Eof2+ cCcw== X-Gm-Message-State: AJIora8Z1N5narwfQiAGBC1dZuslXekFCVt3qLiXvbU8qa4viUNLvQns z1VgHbiZ5bwc78dTEPovp/q8XV71 X-Google-Smtp-Source: AGRyM1uAKruciYNWn9n8tAIb6oxvEn3xnxkO+hCSwHMHYv2yyVL8emmK2owHKZStfkeJnExhZNLDig== X-Received: by 2002:a05:6402:5415:b0:43b:a888:fefe with SMTP id ev21-20020a056402541500b0043ba888fefemr22088675edb.302.1658914681931; Wed, 27 Jul 2022 02:38:01 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4248:b0:43a:77a6:b0d with SMTP id g8-20020a056402424800b0043a77a60b0dls313648edb.3.-pod-prod-gmail; Wed, 27 Jul 2022 02:38:00 -0700 (PDT) X-Received: by 2002:a05:6402:2756:b0:43b:fda4:abc6 with SMTP id z22-20020a056402275600b0043bfda4abc6mr13823757edd.274.1658914680485; Wed, 27 Jul 2022 02:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658914680; cv=none; d=google.com; s=arc-20160816; b=IJzOTQJThOgw+lostBjy7dmbFi0f4zYiMvIWykSCNZ2uiAJ2DL8c1spI1qM+ApMiPY Jy7GEXshXoesPj98FOfZn4/hColFf4pXf4CnH3GIO8cpMHX10AxC+Asx7kOH6DesZ06d FXN89XDamjfYh7AZOftwifkBgw3hdcLldHsnNFCZeUB5MUa5wjCKq2QdtR8cOcojS358 OI1h8bWOKDal6DlJRAcw3BJkYaVGYKyXUawBX9dMODlhMB4tX0QeT48UOJRCzQ5XfpC2 nVPAZVUWRCn2rUtcSLG3lG8QnGIVrU1hmF5U+nDkmcLDOpVdN4aCI8SzTUvBaefCq44K sgNQ== 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:to:from:dkim-signature; bh=DD7+ShKgaM7CrLp2fVtWX6L/5dfIJ86fIXwLfW6VMfE=; b=Cmmf8jbxfq7QK7StjnstZkw7Q6VM/HwSf1NrPXx6SJC8pMX2a2lBJ67rjdYU8AKjXG MombFebjM8oKRtOXGxdhDlNEHsGLX2yfN+Do37v0KQAK6rJFPcPwrmn81Yr80FfDiR5H zK6E2d9v8+Q9x/J79SNL6FBFfr+n/DCkaTZNZ7fjXd4Nr9AdFYjBVnLRbGvMXZblpb86 v44C1B7v7j7NfPt/6e6DQ16cohK0QZJoDjZ1M0KbyOP3cmZwF6VTTr94DSsYH7cUKZsH EHQVqSf/slncoQTuuut9VGOBw5PyxN5NNdWjELbrb8En6xefUxEstpmkHwkhRWhelckd 6X0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=COBy4SME; 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 s10-20020a170906a18a00b00702d89a4050sor6213168ejy.54.2022.07.27.02.38.00 for (Google Transport Security); Wed, 27 Jul 2022 02:38:00 -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:84e8:b0:72b:6d91:a0d1 with SMTP id zp8-20020a17090684e800b0072b6d91a0d1mr17606571ejb.60.1658914680211; Wed, 27 Jul 2022 02:38:00 -0700 (PDT) Received: from panicking.amarulasolutions.com (mob-37-181-33-55.net.vodafone.it. [37.181.33.55]) by smtp.gmail.com with ESMTPSA id q22-20020a17090676d600b006fece722508sm7317678ejn.135.2022.07.27.02.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 02:37:59 -0700 (PDT) From: Michael Trimarchi To: dario.binacchi@amarulasolutions.com, Tommaso Merciai , linux-amarula@amarulasolutions.com Subject: [PATCH 6/7] mtd: nand: mxs_nand_spl Fix loop exit condition Date: Wed, 27 Jul 2022 11:37:47 +0200 Message-Id: <20220727093748.1415135-7-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220727093748.1415135-1-michael@amarulasolutions.com> References: <20220727093748.1415135-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=COBy4SME; 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c index 6d8ec5b3cb..c7ea09e2f9 100644 --- a/drivers/mtd/nand/raw/mxs_nand_spl.c +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c @@ -260,10 +260,10 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst) page_offset = offs % mtd->writesize; nand_page_per_block = mtd->erasesize / mtd->writesize; - while (block <= lastblock && size > 0) { + while (block <= lastblock) { 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) {