From patchwork Wed May 12 14:44:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 435592 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4999865jao; Wed, 12 May 2021 09:45:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwT8typdG40xgKrOQD4Xr7YODD7UKXORF6EM2GpTdWXsx/LpTcMw9oEt9NG5JamBg32hR/ X-Received: by 2002:a92:de05:: with SMTP id x5mr31782324ilm.156.1620837911652; Wed, 12 May 2021 09:45:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837911; cv=none; d=google.com; s=arc-20160816; b=LMpfmCNLCIfi3TKC4b7UygNxMjJc5+x13GpRwpKA/L2NAcCZqQgaYzeQuVRzFfVqtV tDs0S46gmm9yF/JrWKiMLFOtbyUO1oLooV2FN735X+dkiV4z8H4AITPjvCtgwtivUUTD FXVcmHdCz17suVP3ogXAED6MFd9x8nv63VrVSSDTRzzH7JGdDGqMjcC5Skat1hT5cvoq mFJfgZiOYEtHQwMCBtQQl30EyRdruHGc3/J0Z0tCiuY5zg07va4CRdWMaWE1MlPeC51R 1c4hKP/GNUvTdvNlRohLViMeixUTF75F58HPIOJDRK6U7+nWfV14MnVEYaNHoMcbOr5I TnoA== 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=wdeBGBGdwrh6rG7ZcFKjcFsa8ZaqO9D/jveeCkPyJ7I=; b=v8VrNfFuOf5x0ZjcXCFjgWaXfNraKfR69pQWsTmBzqb0INnY9keS/leXgMDYcfQwNu a0dGGxEaMAf5mgYfAoRmwgtUVWc6h8wU0vS/wXZ5oKzNVTQpn+t3nXfFI7949o3G9n8t 1RsU9uqvvvJgt+dCHgOPE/m5spSKTNdyBVVc1eNbzAn2+6oTqyb1SctrQxk87QfsTFDD xT+5alKapqMYmGg2zFzV9FduEWVSrkDiM+RrRZo4m6+syKJcMlpyIkFVBsqmBTpX00hO Ae/XRcRjdPkIzDBIAi6C1HgPNcqflUf/Jq1msLXqqQ3Yq07nhDVUvxn+5k7P3dDL8lFB lC9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=12ajpGDU; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 q8si330223ior.12.2021.05.12.09.45.11; Wed, 12 May 2021 09:45:11 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=12ajpGDU; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S235540AbhELQDa (ORCPT + 12 others); Wed, 12 May 2021 12:03:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:41762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231405AbhELP5q (ORCPT ); Wed, 12 May 2021 11:57:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 484BA61CBA; Wed, 12 May 2021 15:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620833485; bh=nijJKkOFtrIpFW9WD1G417CrwixcpBLkAhMUnVuFZr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=12ajpGDUpfOU1y+2jM/Fzabqx8JggqCgEsiDnzgPUpj4y+Q6bmZ1ZmcNPoMaso0XD M/QgK/2iGNAr8koarwCI+/4sZp0r+q5/LFILPbUE6J2byUaf+gvW+Lf0RBG1fxATwE Qbyr2JbqdW9w8uwBgFe4dZghXcerWvSxjvu0H76Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Miquel Raynal , Sasha Levin Subject: [PATCH 5.11 168/601] mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions() Date: Wed, 12 May 2021 16:44:05 +0200 Message-Id: <20210512144833.368196746@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144827.811958675@linuxfoundation.org> References: <20210512144827.811958675@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Manivannan Sadhasivam [ Upstream commit 08608adb520e51403be7592c2214846fa440a23a ] There are chances that the parse_mtd_partitions() function will return -EPROBE_DEFER in mtd_device_parse_register(). This might happen when the dependency is not available for the parser. For instance, on SDX55 the MTD_QCOMSMEM_PARTS parser depends on the QCOM_SMEM driver to parse the partitions defined in the shared memory region. With the current flow, the error returned from parse_mtd_partitions() will be discarded in favor of trying to add the fallback partition. This will prevent the driver to end up in probe deferred pool and the partitions won't be parsed even after the QCOM_SMEM driver is available. Fix this issue by bailing out of mtd_device_parse_register() when -EPROBE_DEFER error is returned from parse_mtd_partitions() function and propagate the error code to the driver core for probing later. Fixes: 5ac67ce36cfe ("mtd: move code adding (registering) partitions to the parse_mtd_partitions()") Signed-off-by: Manivannan Sadhasivam Signed-off-by: Miquel Raynal Signed-off-by: Sasha Levin --- drivers/mtd/mtdcore.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.30.2 diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 2d6423d89a17..d97ddc65b5d4 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -820,6 +820,9 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types, /* Prefer parsed partitions over driver-provided fallback */ ret = parse_mtd_partitions(mtd, types, parser_data); + if (ret == -EPROBE_DEFER) + goto out; + if (ret > 0) ret = 0; else if (nr_parts)