From patchwork Wed May 12 14:44:20 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: 435568 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4944512jao; Wed, 12 May 2021 08:41:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkAXgc0wOzQMog20HJ09zaoTeajmyd2WMKHPfKDChaeSvJZRJ5IiNP3soYQHGG82CggQgW X-Received: by 2002:ac2:5e36:: with SMTP id o22mr26168741lfg.529.1620834076996; Wed, 12 May 2021 08:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834076; cv=none; d=google.com; s=arc-20160816; b=1GYP8uSiYIDzOEI4/zVH0BuJZ5mPG/+srCCevjTTP9u6EhQtxKPxByBefQoO9lPJGo 2ualCL+XUdje2V53rlnFasbv9ya8tcjjPTof4FNbQd/RHR/y0nBxxxdWYJrTzXa5VEj3 G3wXdg2/RcNk0sALbwjLOsGihj0naf6HhUBQYZdfvujCa48uKD4DgHWtmHiVIoLCjtz5 AZ/drnkIOLCr7fFsxXndmhxCaS5fhPV7Z4lYM/Jz/HpCYhLe3qZ9BNqP3rx54OUK8kB2 MNI+CV8ifu9ym2K+9/u0WXkD/rClhCXozZVP20JPleyxJiBcTHBdq47uZZLujsEJr0LE /t6w== 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=yqP0eXlnrsqZmM1Vn8TPyVu6QfrAHe3E15FZLD1Zx84stbP9h9+Nh8tu/j6qHcHma7 7nLo3pZ0HI9tp3yUtgLcT2d/EsHRACUmKFuELhN8weGeBZKqaznXqeFqjy5fOGJfJ53C yp2FYJ6EWfJPvYZlhP4kAXx8vcmBRNIRE1mq7BGqrQ/f7I60xC6Rs6e/aKNqLNSjLAHM G0d5cmErPIUjM72J6rRJWPPIOExCMrZ2T9zd6qn1FHEFuSUeVqHw0YCm/TFKJMSN97iu HerwVAn2AKtFoaHsLEfnQvCwAYumrm5Mup3yBpb/lHDbw8CngPr76S5qYGPYDvaSmmsp hLRQ== 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 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 m20si100438lji.284.2021.05.12.08.41.16; Wed, 12 May 2021 08:41:16 -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=C5Pz6JKf; 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 S234504AbhELPdD (ORCPT + 12 others); Wed, 12 May 2021 11:33:03 -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 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 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)