Message ID | 20181108110653.21063-5-tudor.ambarus@microchip.com |
---|---|
State | Changes Requested |
Headers | show
Return-Path: <linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ffVLPLym"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="GeuEeA3i"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="z6yE0fSi"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42rLCQ3v2dz9sBZ for <incoming@patchwork.ozlabs.org>; Thu, 8 Nov 2018 22:09:38 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hEo3sdLBm5ImVYJju+wZDyGldsjubv4enyqjFnO7l4M=; b=ffVLPLymmD9mSm l203dvuL6vFt5mAA+4yz+pBEzU1buf72ulv7tNLccM7363nqIMdWIRjAzo8cf9jXPhaKY2Vkr6yon SllNA9OnB6oKXa5xeV8xBQIKL5ZDcgVdVjUtjgYtRn6rXbYZUMIDN1Ttrpn8UCMTbQ1G1G422cnH3 4172LxrJ0YDu/nV4Dw2nfRgEhV9jO7+pT6O3l1WVj/IoCM/NAU6GWGACMHGvczqHO+G39pdDKUaT4 TCqWIdZqLTLHh0cEHED5gqo558/w4snMF5quwGbX9M2lpaRcgnXR2AXsQvCdG9oK8u3Ks3mK+nT4s hnNqZl+HFDiloYHPmifA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKiBo-00013G-1h; Thu, 08 Nov 2018 11:09:32 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKiAR-00085V-Le for linux-mtd@bombadil.infradead.org; Thu, 08 Nov 2018 11:08:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=MIME-Version:Content-Transfer-Encoding: Content-Type:In-Reply-To:References:Message-ID:Date:Subject:CC:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=pBUlYBhb+c6yBav8ojSC75619eNKq+mFFk4RSE+K3rU=; b=GeuEeA3iBIvf6TepPLNmKZd7Gb B2bYAyPU79ag4g4dbmXiQdtn3yDMnerLOdAxZzkCQOO5iDQM0BFslR0rHK/xByBE73GQg9aOMkb8W MrTCprbA8lodHQPCc9xssdCCZm0YmwhonRtWwW8TvlN6T9WXfw7T3t9vnchKvoE+ZDX1PDy1d+pM8 DEYLQTMPKN+1A7D6zZJPgrrnhQSM1dizAm3cIr+3MmG57WUQJ0x84oh966tY4yDrjw4anuXO9yYes 5bYgkg10eodCFl7gZ4fOIy8gvDdrGO4nokdOrpIgmF3If7b6jfPfJq7KQHAB0TKVU3P4BFqUTpHL0 5YHMdFyg==; Received: from esa6.microchip.iphmx.com ([216.71.154.253]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKiAO-0004E8-HS for linux-mtd@lists.infradead.org; Thu, 08 Nov 2018 11:08:06 +0000 X-IronPort-AV: E=Sophos;i="5.54,478,1534834800"; d="scan'208";a="20108336" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Nov 2018 04:07:43 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Thu, 8 Nov 2018 04:07:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pBUlYBhb+c6yBav8ojSC75619eNKq+mFFk4RSE+K3rU=; b=z6yE0fSiDN/fd/4FGjW6XclnQzY8ze0ONgZIA9AsXxKwxIFxwB9+6EOLs67T3x/yv95Mixldv7IPNEXXE4bJjL95CVzY0m6I27ig9h28R2Ued4iJ0qOZfJCxM3czjpx1dboJGVnB9/vEKqJ7QbCn8QDqlxUK7gN7Ts39tWd3igY= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.99.146) by BN6PR11MB1987.namprd11.prod.outlook.com (10.173.32.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.28; Thu, 8 Nov 2018 11:07:14 +0000 Received: from BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::11b7:21db:803a:7cfa]) by BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::11b7:21db:803a:7cfa%5]) with mapi id 15.20.1294.034; Thu, 8 Nov 2018 11:07:13 +0000 From: <Tudor.Ambarus@microchip.com> To: <boris.brezillon@bootlin.com>, <marek.vasut@gmail.com>, <dwmw2@infradead.org>, <computersforpeace@gmail.com>, <richard@nod.at> Subject: [PATCH 4/7] mtd: spi-nor: don't overwrite errno in spi_nor_get_map_in_use() Thread-Topic: [PATCH 4/7] mtd: spi-nor: don't overwrite errno in spi_nor_get_map_in_use() Thread-Index: AQHUd1MzYZpAB0RHpkqXRQYYdH27Nw== Date: Thu, 8 Nov 2018 11:07:13 +0000 Message-ID: <20181108110653.21063-5-tudor.ambarus@microchip.com> References: <20181108110653.21063-1-tudor.ambarus@microchip.com> In-Reply-To: <20181108110653.21063-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0401CA0009.eurprd04.prod.outlook.com (2603:10a6:800:4a::19) To BN6PR11MB1842.namprd11.prod.outlook.com (2603:10b6:404:103::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Tudor.Ambarus@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BN6PR11MB1987; 6:J9e+5kwPZRpu5IwxKiwCaWVsTbat1qnkJ8qqW/Qo/k3zyJ8jY+0t/LEWDS//P5MGHyxUyR+3N55NWXAMgISPJydtQo2MGo36J+/9kuR11tULxhcNZbhL32jQuMLitGKuDZhWUIAdxysx254S+q1XyUNvkGJSO5nQW6jRupp5eROD0bsHuPJo0SNw1ZDM7PujltfCPDrs82TcWVaolcGeFymyZxsCEfonqoEN6EJOChLA0h4XEbwFKunG1VzV8UgQs1jCwYDTx2WCvgNxrMULZ/tgMn28cQ2HFDA+Z/aHxfHhFiofcmXR6jOK0RycODgYGoXKoPOBv8Sh+cmbKYNSdFaomhbw4TbTrBgocFItE0CQbT/ykBeZ/egfbzDNJZ33RZ0RGipj6kLFOnW+txbxBmr5vH5bsSXo51kF2m2UXoLQ3h5B8ik3WfzPF0jhyo0xBxHA+1w/0lZUv/ECC7qHHg==; 5:K+kHRZhIZP52buk2Kajv8freY6tPRzWviLvdAKZiTIBqlo5tSyJbWA9XIQhgyG/uehFhvSN3+gcL7rMFpbkieoEK+4pAKaNlbp9RCCZlbobR+YwrsWHAyarOazTdhS2QiwT4fuaXjs+zZvnclWB5wvwNpOf9M6jsJ/QfssSEaus=; 7:tO5SDMdkXL2gyzMCtWoMmiA34QiwLrYd9IdcbSFfzXspnL2r2wLvyBL8wgHIlo7JitWrjfoGB98hfPa5zNOW/6TsomCQUKwuBn3ZiVqI39AxLry9d8aZOMD28NpdknRzXKVEKQI8xCq7GI2bsSPk5Q== x-ms-office365-filtering-correlation-id: 49a1ca5e-ddf4-4255-9bd8-08d6456a5642 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BN6PR11MB1987; x-ms-traffictypediagnostic: BN6PR11MB1987: x-microsoft-antispam-prvs: <BN6PR11MB19875A718F402C9554617F68F0C50@BN6PR11MB1987.namprd11.prod.outlook.com> x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3231382)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:BN6PR11MB1987; BCL:0; PCL:0; RULEID:; SRVR:BN6PR11MB1987; x-forefront-prvs: 0850800A29 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(39860400002)(346002)(396003)(366004)(376002)(189003)(199004)(72206003)(8676002)(81166006)(5660300001)(81156014)(102836004)(14454004)(68736007)(305945005)(26005)(86362001)(1076002)(2201001)(39060400002)(7736002)(8936002)(2906002)(2900100001)(36756003)(3846002)(6116002)(71200400001)(71190400001)(107886003)(97736004)(6436002)(6486002)(110136005)(54906003)(2501003)(2616005)(11346002)(446003)(99286004)(53936002)(6512007)(256004)(4326008)(478600001)(66066001)(52116002)(386003)(6506007)(186003)(25786009)(316002)(105586002)(76176011)(476003)(486006)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR11MB1987; H:BN6PR11MB1842.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: CR9o7z4gP5lzBvzXAR0/840aQscHbxa8lXe36CuvxByDEU8+86EoJr02BID4wSs2sZjsc3kO1T5t98dMdI8i1/mt3HVvOpivLlFyhFvYiRD5yc4NSM6CFkMztLp5zKGgl3gB0G1kVTlNnLMh45LXH1ONswSpHa2X79w0eSlNf8s9MizgNu1bOjpcX1g+OsJ9nosUZdW7AUYbyLAXahOihSmfVPJyB0bYdDrV8EQaVOTN/kE7DzmEftWFaFTfYlcEHsRk3bUhVs52ZSTc5RkSMwKYm7mrbSX8GZIf7aWiY7e6Jcw9cQM7jNw6SU+tnkJjEz0D7imKWBauJW7vkuU1om3B0LnSJmZjvNtN6kn0MDk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 49a1ca5e-ddf4-4255-9bd8-08d6456a5642 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Nov 2018 11:07:13.8692 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1987 X-OriginatorOrg: microchip.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181108_110804_861277_491ABDDF X-CRM114-Status: GOOD ( 14.45 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-0.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.71.154.253 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIMWL_WL_MED DKIMwl.org - Whitelisted Medium sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list <linux-mtd.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-mtd/> List-Post: <mailto:linux-mtd@lists.infradead.org> List-Help: <mailto:linux-mtd-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=subscribe> Cc: yogeshnarayan.gaur@nxp.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Tudor.Ambarus@microchip.com, cyrille.pitchen@wedev4u.fr Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" <linux-mtd-bounces@lists.infradead.org> Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
mtd: spi-nor: fixes found when debugging smpt
|
expand
|
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index bd1866d714f2..79ca1102faed 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -2861,11 +2861,13 @@ static u8 spi_nor_smpt_read_dummy(const struct spi_nor *nor, const u32 settings) * @nor: pointer to a 'struct spi_nor' * @smpt: pointer to the sector map parameter table * @smpt_len: sector map parameter table length + * + * Return: pointer to the map in use, ERR_PTR(-errno) otherwise. */ static const u32 *spi_nor_get_map_in_use(struct spi_nor *nor, const u32 *smpt, u8 smpt_len) { - const u32 *ret = NULL; + const u32 *ret; u32 addr; int err; u8 i, ncmds, nmaps; @@ -2889,8 +2891,10 @@ static const u32 *spi_nor_get_map_in_use(struct spi_nor *nor, const u32 *smpt, addr = smpt[i + 1]; err = spi_nor_read_raw(nor, addr, 1, &data_byte); - if (err) + if (err) { + ret = ERR_PTR(err); goto out; + } /* * Build an index value that is used to select the Sector Map @@ -2907,6 +2911,7 @@ static const u32 *spi_nor_get_map_in_use(struct spi_nor *nor, const u32 *smpt, * * Find the matching configuration map. */ + ret = ERR_PTR(-EINVAL); for (nmaps = 0; i < smpt_len; nmaps++) { /* * The map selector is limited to a maximum of 8 bits, allowing @@ -3056,8 +3061,8 @@ static int spi_nor_parse_smpt(struct spi_nor *nor, smpt[i] = le32_to_cpu(smpt[i]); sector_map = spi_nor_get_map_in_use(nor, smpt, smpt_header->length); - if (!sector_map) { - ret = -EINVAL; + if (IS_ERR(sector_map)) { + ret = PTR_ERR(sector_map); goto out; }
Don't overwrite the errno from spi_nor_read_raw(). Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> --- drivers/mtd/spi-nor/spi-nor.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)