Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4607255pxj; Wed, 12 May 2021 09:08:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoiv8i7SKZ6NpJmiGyTjJh46pCmlARmCOHzlHx5JUq2fdF9ic4y+MhRUEdJr0KbsXDZ8Nm X-Received: by 2002:adf:a316:: with SMTP id c22mr45170379wrb.202.1620835705833; Wed, 12 May 2021 09:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835705; cv=none; d=google.com; s=arc-20160816; b=tW6QKE3vVDufjXu6Eb/CkUhu9IGjHJS5cGh1hXS2LcrMOsW6RkOBJKHLK/Av3MYmZA Kwe0ZX9f98cjiCaClNHWp9Uh+IJ1C5mxIT73p1kbmkUQzwZld6a3diySLH6nCF683f+T pLuiirGsa76nKjHRqkCCftDMAl+QlMTEKa35RjF8wacvgFyd7S3Mx9TfY3ADl5quz/KC NRmhtA6EjKrHTIkjBYwW6DbHhzpYt/+Y/5RXpzOIgX3gHDpIOga4ITguXiNJL8X2h4oO YxsetL9ravM1z9Ic4wTNXO7YO292JN3bs/r9I/MWHtogTd1KYWoq6CK+M/aJWNNWZq94 WGZA== 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=SRXxQ5vOX0zMGYU/NmZBWofSyMgx8Gpu1eGcy/QVjJM=; b=QTqlrqwiZKznfMglsHThniZ2eRyuF7Ifh/46pYtATrzr5NfRyjV44j0pFFhAP3qHl2 dwlhQT+5jg8RtiztUoxI76AYo1VfBU6WBoCGAksT7U0gn7dmrCEy4YHCYybV5j+0yqIH hBdJgLIogBfX0DGhKAxrqPQ5E0k4ZukxyHhn7M6xORi7/Avz8H3dKX99xwQ1O6W/Jao6 B+7J7RTtTzZSYEPecYy6d99Y7gwVSeTtmyfbNgyWeiQXu7HhNOAuIWO9yx61B5n9BDvj NgHEN4VDDp/+HByntpIWvKUDzjDSMXQEjo5hFnJpYiJCGroi0JfXXirg3cHNaQDiOvAT mOUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C5Pz6JKf; 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 g21si356117ejx.118.2021.05.12.09.08.01; Wed, 12 May 2021 09:08:25 -0700 (PDT) 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=C5Pz6JKf; 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 S238704AbhELQGC (ORCPT + 99 others); Wed, 12 May 2021 12:06:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:60686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234279AbhELPY3 (ORCPT ); Wed, 12 May 2021 11:24:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A4A04619C5; Wed, 12 May 2021 15:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832205; bh=EbU8vG/bL1/P9oUMT1oMgo5/upTIpLYpXuIbEWm/PTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C5Pz6JKf5AQnv23rabI/2I5E9pUx8StbSOQ5kUPAAvvKsYZWiy5wI/9yy2kOEGDOa 4Lh8EK5LZkj5mBa4j6HGiqJk6yC9MkREHLX8j1LBhsFgPa067XM9DZBd6cZ90fOdLb Ku8uSTkWkrlKki5Hon6DozzpPutePIEyMz9TFdec= 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.10 150/530] mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions() Date: Wed, 12 May 2021 16:44:20 +0200 Message-Id: <20210512144824.778555365@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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: 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(+) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index b07cbb0661fb..1c8c40728678 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) -- 2.30.2