From patchwork Tue Apr 4 06:17:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 96680 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp48176qgd; Mon, 3 Apr 2017 23:17:57 -0700 (PDT) X-Received: by 10.98.87.216 with SMTP id i85mr21704243pfj.151.1491286677271; Mon, 03 Apr 2017 23:17:57 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si746909pgf.57.2017.04.03.23.17.57; Mon, 03 Apr 2017 23:17:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751237AbdDDGR4 (ORCPT + 6 others); Tue, 4 Apr 2017 02:17:56 -0400 Received: from mail-pg0-f47.google.com ([74.125.83.47]:34667 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750962AbdDDGR4 (ORCPT ); Tue, 4 Apr 2017 02:17:56 -0400 Received: by mail-pg0-f47.google.com with SMTP id 21so142756191pgg.1 for ; Mon, 03 Apr 2017 23:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ReFQDEBKfMl7fxZkhWSQqvrSiHRA2Q5zEjurGWC4ahQ=; b=L3u0sNuhJopsjODb6KLFhYnQETksNQnyxerC83ovqUY5rbPuyaIez43w3hgjz4Lrq5 V+zeT0xfLntVSS3yXYSgXxxSZz5+fRctaNnM/tssLnhJZQ+4M3x+4+lfoftQQ8GDHlgJ sKP6Ui0BZ2toR/N690aD7MXS/jBTRRFt0nrdk= 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=ReFQDEBKfMl7fxZkhWSQqvrSiHRA2Q5zEjurGWC4ahQ=; b=Ko4R1O98Do4KLL5Zp+7Bd/E2WvFSXhI4Kn/EvrxqiKFDJ0CTEsPH1hn7WHLq3QCMnY 2k9+6cAyzUF/Uf9vbr8gtmwmWC19OGuRONqwMhMScI+UGchk2yny0IkxQXi5hS+XfXfR 6qKpKNtdDH6N2olgBdDYo2+7ul7QLXOLxrxxvFqawwBaS7M6ZoBQh5qTcZPFcVurEUDt iLvPNsAerrmHdFDp4p8YmgaqjToFQZjEEJzdntD8ocaAZgu1ERRHUzlSiUIHrSKG7AXC lsdtDyGcOhamuCVUmkj/UF3XyHHgLvUnlM1+27C/M62JDG47+/Kmqys3yNGM1QcXhywF iNvg== X-Gm-Message-State: AFeK/H2lRP6XXYLhjgcN+JeB8+fWDJCgKiIkCAFSHAWm97EhYLvCS0Vb16I3KPGNcoLphDPC X-Received: by 10.99.216.85 with SMTP id k21mr21815455pgj.10.1491286675387; Mon, 03 Apr 2017 23:17:55 -0700 (PDT) Received: from localhost.localdomain ([106.51.240.246]) by smtp.gmail.com with ESMTPSA id l126sm29224804pfl.56.2017.04.03.23.17.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Apr 2017 23:17:54 -0700 (PDT) From: Amit Pundir To: gregkh@linuxfoundation.org Cc: stable@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Brian Norris Subject: [PATCH 18/33] mtd: bcm47xxpart: fix parsing first block after aligned TRX Date: Tue, 4 Apr 2017 11:47:32 +0530 Message-Id: <1491286653-31193-9-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491286653-31193-1-git-send-email-amit.pundir@linaro.org> References: <1491286653-31193-1-git-send-email-amit.pundir@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rafał Miłecki After parsing TRX we should skip to the first block placed behind it. Our code was working only with TRX with length not aligned to the blocksize. In other cases (length aligned) it was missing the block places right after TRX. This fixes calculation and simplifies the comment. Signed-off-by: Rafał Miłecki Signed-off-by: Brian Norris (cherry picked from commit bd5d21310133921021d78995ad6346f908483124) Signed-off-by: Amit Pundir --- drivers/mtd/bcm47xxpart.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c index 3779475..283ff7e 100644 --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c @@ -229,12 +229,10 @@ static int bcm47xxpart_parse(struct mtd_info *master, last_trx_part = curr_part - 1; - /* - * We have whole TRX scanned, skip to the next part. Use - * roundown (not roundup), as the loop will increase - * offset in next step. - */ - offset = rounddown(offset + trx->length, blocksize); + /* Jump to the end of TRX */ + offset = roundup(offset + trx->length, blocksize); + /* Next loop iteration will increase the offset */ + offset -= blocksize; continue; }