Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3696626pxb; Mon, 24 Jan 2022 15:38:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8NjxMv7CJbyPCMuR9NFvhoavsbweD9nL+FzKfSO1yf6eyHW295V4FbSQYQyCC2zYSg4xw X-Received: by 2002:a17:902:7148:b0:14b:650c:4ce7 with SMTP id u8-20020a170902714800b0014b650c4ce7mr3210861plm.4.1643067492810; Mon, 24 Jan 2022 15:38:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643067492; cv=none; d=google.com; s=arc-20160816; b=vMqtTJy+MxT13M57GEEgkRpsDwzIXgOFSU6epTvGBHO2ywDs8pCpb64THH2JfsD02B ehbPu2xtTs5t1EmVn9ByP646zT0K2PAOUC5TYUleDhGk0zrUsMPxSTSqdTuBTUv4abYV xrtAakwunKLAXjxw+hNgGZ/QnPeVK+KULhq5aFpRIqWZQxvhBkTGWGKSqRtL64q1iZHi xHwnKkRHu07zxQrwwVLJuUK/LmXlHnkOs6FpBx3Lt+hUVGw+ANF2cybiU96Q71nQvWvJ hfL7W7kIUKD3VjivE0dfvlFajAglPKKgZUHgSp4l3vuQ40VRM3Us2144TeY9vaD1nOM3 VIig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7Hambx+NF0kgjJHtdDu7gguLJ343ljw2d8niPkimi+Q=; b=T83QIzgfjom1UF5WCjitfc5JwIwtet+8Aotbccenf8FTP1VlwWkRGHyfaOJuEOMVDw dx2cvTqeoyNkIuQ35cPsa0Blig5mNN04IISgoKAvtj7OvcvsNQCAHl51slIu5vNWD2Co e7nzQpNeamMOxWNplbuPr5WZe0mDrVAe0iUzDkagSNifMnFHdfu0RJbEXFW+dqvpvdaJ bKpGu4ssS6cIgrdrnUUqAV3TxBBn1PdFgQ1WJqGg1iZx5O2tqwUfSuiLz3+1hTzk+Bv4 xSoPhIJgTJSA2jR2cdsoS6F4VzEryo1pSetcB39VZVnAA5FfH6dVaZoAPlfsg1IjHImz KCrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="W/aQrUEW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i7si564036pla.230.2022.01.24.15.38.00; Mon, 24 Jan 2022 15:38:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="W/aQrUEW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385896AbiAXXd5 (ORCPT + 99 others); Mon, 24 Jan 2022 18:33:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837266AbiAXWnh (ORCPT ); Mon, 24 Jan 2022 17:43:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2573BC06B5B3; Mon, 24 Jan 2022 13:05:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E2A1DB812A4; Mon, 24 Jan 2022 21:05:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C774C340E5; Mon, 24 Jan 2022 21:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058327; bh=600Hk523HnsrfpbtHaU+cy1D3C+NbPHA0zIhJYZR4X4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W/aQrUEW++ieWvYbgzy7sLoOLBK7IgPwr0NmLiOLi79Caq7W67fEplGND2UCxF0// p5zwvndYwqlBYs/CXm7h+5SEmzq53f8fuigknZOcdGB4vQSHxCeqAas5HHpaBkvFur deAvd2hnxejESX9HSU0IGG9gggdTIKQQPc0CtUUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Pratyush Yadav , Sasha Levin Subject: [PATCH 5.16 0253/1039] mtd: spi-nor: Fix mtd size for s3an flashes Date: Mon, 24 Jan 2022 19:34:02 +0100 Message-Id: <20220124184133.828118858@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tudor Ambarus [ Upstream commit f656b419d41aabafb6b526abc3988dfbf2e5c1ba ] As it was before the blamed commit, s3an_nor_scan() was called after mtd size was set with params->size, and it overwrote the mtd size value with '8 * nor->page_size * nor->info->n_sectors' when XSR_PAGESIZE was set. With the introduction of s3an_post_sfdp_fixups(), we missed to update the mtd size for the s3an flashes. Fix the mtd size by updating both nor->params->size, (which will update the mtd_info size later on) and nor->mtd.size (which is used in spi_nor_set_addr_width()). Fixes: 641edddb4f43 ("mtd: spi-nor: Add s3an_post_sfdp_fixups()") Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav Link: https://lore.kernel.org/r/20211207140254.87681-2-tudor.ambarus@microchip.com Signed-off-by: Sasha Levin --- drivers/mtd/spi-nor/xilinx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/xilinx.c b/drivers/mtd/spi-nor/xilinx.c index 0658e47564bac..0ac1d681e84d5 100644 --- a/drivers/mtd/spi-nor/xilinx.c +++ b/drivers/mtd/spi-nor/xilinx.c @@ -69,7 +69,8 @@ static int xilinx_nor_setup(struct spi_nor *nor, page_size = (nor->params->page_size == 264) ? 256 : 512; nor->params->page_size = page_size; nor->mtd.writebufsize = page_size; - nor->mtd.size = 8 * page_size * nor->info->n_sectors; + nor->params->size = 8 * page_size * nor->info->n_sectors; + nor->mtd.size = nor->params->size; nor->mtd.erasesize = 8 * page_size; } else { /* Flash in Default addressing mode */ -- 2.34.1