From patchwork Wed Apr 5 10:32:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 96829 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp196369qgd; Wed, 5 Apr 2017 03:34:28 -0700 (PDT) X-Received: by 10.84.238.139 with SMTP id v11mr34756754plk.189.1491388468116; Wed, 05 Apr 2017 03:34:28 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si20203815pfi.300.2017.04.05.03.34.27; Wed, 05 Apr 2017 03:34:28 -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 S933535AbdDEKe0 (ORCPT + 6 others); Wed, 5 Apr 2017 06:34:26 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:36860 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933475AbdDEKdZ (ORCPT ); Wed, 5 Apr 2017 06:33:25 -0400 Received: by mail-pf0-f169.google.com with SMTP id o126so5587386pfb.3 for ; Wed, 05 Apr 2017 03:33:09 -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=ksM11rRx9TQi9WgSQC7SP7SiDkxoct2Da9sqwlfUxxnISYM78aA9DTpOKHIXdF2QRW xsbK+kJXI+0WB191/rGIuZrq0abl86VdX+bVOYSk2258ZfT9UGlxMRfsdK9gKEJeQ8yI r4zjV151illqgiA6a0CwGP2VJNXknfhBfh++4= 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=XlUw7sWpAKNGoGWl86qAsmOTvOy5kgVuqNAiNVNRPsZbkaJ/K/zZJAbD+MjCEzmBxq 2hc9B8QWgj7laHHCFKKeOaQfGtBTvq6mJx1EonT2mg2Bneetp6Fpdft0g17tbnzCIkaO IqQLOfX8bR2qTdye+d6/f9eqAjKFqChofv+93bTgQ02q/p4IxJ30KGMCeVZ/wxxpr6e/ +Yqc6xzj4hsybvjZVdCCm1MdfVnUcPAPvxhq5RWCcd7d9juHgkShtXp+kEL2vLzMLFBc oTuGZSXBtNMQb+oMZBzExXUtZFsAImDOBhU6WpGm+ztNr5QkRSKbn4piRVSQAHCici9C xsbg== X-Gm-Message-State: AFeK/H0NQ1uGYSeI3u3GshAyB6eH1cvVMfou6jh6f5mKgMUrIZmpphu0ZuUvtSyQeVKVTmIM X-Received: by 10.84.173.228 with SMTP id p91mr35157950plb.18.1491388384084; Wed, 05 Apr 2017 03:33:04 -0700 (PDT) Received: from localhost.localdomain ([106.51.240.246]) by smtp.gmail.com with ESMTPSA id a62sm36732075pgc.60.2017.04.05.03.33.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Apr 2017 03:33:03 -0700 (PDT) From: Amit Pundir To: stable@vger.kernel.org Cc: gregkh@linuxfoundation.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Brian Norris Subject: [PATCH v2 for-4.9 17/32] mtd: bcm47xxpart: fix parsing first block after aligned TRX Date: Wed, 5 Apr 2017 16:02:09 +0530 Message-Id: <1491388344-13521-18-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491388344-13521-1-git-send-email-amit.pundir@linaro.org> References: <1491388344-13521-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; }