From patchwork Wed May 12 14:43:48 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: 435631 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp5101353jao; Wed, 12 May 2021 12:03:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylbrSGI2q44urO8yt320P42xbLuk1ih/8Q/0E7WArI8U/E0HeL5RFVKYHv4ijoqktP+L8m X-Received: by 2002:a6b:630c:: with SMTP id p12mr22327939iog.124.1620846191126; Wed, 12 May 2021 12:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620846191; cv=none; d=google.com; s=arc-20160816; b=gp6iw3c+xf0u+RIaABw45L8jiowirCPRttnER3u1M75sY1FeDdYC0+6gBETcG6LL/k JKJ7PpFPg7AKNrEtnS1J3m+nvYFSLs2Bb4hGqufjwVYM0/E6ruTAVxT2CzCovot0xuSj Y2eTVoiYXFBbqKrpTgKe+Bt0iUpjrPoeLHHg0V4IYqBoMfv2sLJmiJQbl38wUEgkLf7A P/OoE7bRfRggEHGtYT3uF856rwsvfogg6la7AMi1Kykcg3gPjizZ/hW2euPU9nSlQbRd Ikm3Kk1+pV3pjAZqjLAYc0Agtf2osh+nHY5+cNt3Za89K1fbxfEO7bZsOUSSeiUGZ271 i3DQ== 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=jpPfXhx/aeGkh/HJxnmD3+yWRRddSmhJvh9aXwL7CohEalcxAUAr4cvqtEpZ2Rqp5L IIapqg1fIP5c8Yt5WTtmWQP8W5HfJrxyIc8+HImnue80il1psBH2r2O6f/29/jPeGrMN OCECmXDj7l+R1Q8673FGxZLuAabaCDRW7QxsemITSzf1x+DviVCOYYcSM16IbdKJduQs yb3xoQnZJzOgbS0c+IqsbSxWkkjdRGVY0vbkpPOd/LzLBBVyYVJaIq5TLTjfhW784CFt GMH0wstIO0KyfK2X+S792bzxjFSrL5Cex27W6PFgrrdDcLMnRC0JX+U/7+q1qKrQGch3 449Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VOHlqb0w; 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.12.03.10; Wed, 12 May 2021 12:03: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=VOHlqb0w; 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 S237863AbhELQix (ORCPT + 12 others); Wed, 12 May 2021 12:38:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:44832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239896AbhELQa3 (ORCPT ); Wed, 12 May 2021 12:30:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DCE7661AC0; Wed, 12 May 2021 15:57:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620835037; bh=nijJKkOFtrIpFW9WD1G417CrwixcpBLkAhMUnVuFZr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOHlqb0wrkBTG58OOjWkNEK1AFMFOoMRkEo9DRJ9WsNQHuIYKQDuR22djdtpIySKL XUcusxGyFelG61576tSgEpBRBX0K37H8bqMl4DCBXx7gXOztgkGzvFrCDi6KhOsU7K 5DLrqJH2Ve4yhDJZsMUpPNXTWsPv01v1ahCWWJ74= 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.12 182/677] mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions() Date: Wed, 12 May 2021 16:43:48 +0200 Message-Id: <20210512144843.295955066@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144837.204217980@linuxfoundation.org> References: <20210512144837.204217980@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)