From patchwork Thu May 20 09:19:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 443186 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp2127972jac; Thu, 20 May 2021 02:51:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXhPuGGTs7VxDELcohjskrT4ZX1N28mVFSu39GZaX1Ci49DRSiYPOEd7dHmKMCWwew0SLh X-Received: by 2002:a05:6638:cc9:: with SMTP id e9mr5105287jak.46.1621504314196; Thu, 20 May 2021 02:51:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621504314; cv=none; d=google.com; s=arc-20160816; b=ch6KqVI078R/xgRVAnX+8RurCiOVDJvZxUjmTW5ov8yRPibRPjwM/NM6n11VoiiSK7 9Z0oWhuD7nhnmHkKzY3GWKMI0F/Ix/4CO813T3GT5Bueqn2F2TbnZVwfcSGAVbVR3Kft 6cozW7HvbT3po43c5QlHw0+BDRArDe+YHERQpYtDBer9vdv9fS9Jw8l9c+8DIwQrjHBx rufSdf3X4BEE22M6agyyIpyE5Bt/cZGZhbZbwntTA111V+9vqkCbWtm18ExLWOzZzTl7 o+axJzLiTotfwcsx1XhJrMBPRSEzJ+bOID77IUNUrhNv/+rKebOk9MFp9CTEaCrEQeyj wyZg== 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=+9YHaqULTweKXXdNZvinU3uMi6M3B0/kukA+NLmEAMM=; b=sU3CqL1cuSnIDtt/ce2dEjNY4fGOKn75tSOTDBTlONr1aIdD1pVf5Usk0Za10g9qlg YF+PY2wXTaRt1BzwG1Fxz2/eUw69LBav9jkHUgtIl4kNFSW5JpbkOGvz5XAEUk22NN3X 4cTCHQrrOU85YzRqsfDYNZ1ykbme6ce6WBif9Q0nVDqVbKcc3VLOvsHbq8SFgDI4cEr6 qVly/TUHacv0gcL0RiNyELXmcjChS8oGsS/bjeSJuJX3u6G/gQZOvhohvWMADwXvUgtw wMx2upQWrpFrtWuLsrDREcAnJV0l+EgoCt6scAeXDqhl1PnOm3jMSLlOi9B+3KT68jEk fDiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iIJoYBoR; 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 c7si1876571jap.0.2021.05.20.02.51.53; Thu, 20 May 2021 02:51:54 -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=iIJoYBoR; 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 S233878AbhETJxD (ORCPT + 12 others); Thu, 20 May 2021 05:53:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:54742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233977AbhETJvC (ORCPT ); Thu, 20 May 2021 05:51:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 34BB0613F8; Thu, 20 May 2021 09:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503338; bh=6y9/q81XCOhwDxHVfQosFXIPrGvGte2RFvPw2fZ+69Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iIJoYBoRAD9fev0j5JuGFTSWEGoxwsSviATrUyKIK9NsId/SvnjwloKX/FEqTsf9K EAqbr0cDjz6XacU/Fy+awxnYilVB/YuSZzwikMKr4C5CPWjoEa6nhZb6oaR5Py9HsQ aaPfYzK5xpc/vZaixoNxLo93DO0bkSGr7qWC7KlI= 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 4.19 175/425] mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions() Date: Thu, 20 May 2021 11:19:04 +0200 Message-Id: <20210520092137.189097413@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 97ac219c082e..a0b1a7814e2e 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -712,6 +712,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)