From patchwork Tue Mar 2 19:00:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1446674 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=aTa8YMgQ; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=brVcDz07; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=HufP/ozM; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DrGgP1CTkz9sVS for ; Thu, 4 Mar 2021 01:32:49 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=8JSxvr7k4Ggi37l3VVrzbg6TdVuuBZDQKTGMhbO45As=; b=aTa8YMgQLv90bXpWW4zD3O+mTS wOd1t8Rbuk/raiBnsXfJ6T28AWGQDMnGO1pp2Rgtfyn6eXZ2A7nnNHf/LigDoTy2QICwE5DjjYdqg d8J3ZCVzzTWQUtODdhddYWGyyjzkTsDf8BU58+LLgvpKPdAJjHB4JdGx8NCLaUEL65fn0+DyzhDBe KQ64yMNXamQLbptgjxGD5T9VcFYE4IJbWRlLdMqrVzabyNdyuPIBpa9ldQ1Ux2J0BUe7i7jscFTWu eg+iiP4TkaxccsVa7zEUL1M779hgpYcR1+VXBFhWrMDGFbPtLST1no3SrDrLDD/Fmsc/aVl/h5uHG 20rm2iyA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHSXh-00599G-L5; Wed, 03 Mar 2021 14:32:02 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHS9A-0053VU-2f for linux-mtd@desiato.infradead.org; Wed, 03 Mar 2021 14:06:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:In-Reply-To:References; bh=KMSX1uVxYWS5tl1uR5+DDAeIaBIhtR3YVV13cbow2ak=; b=brVcDz07h91Lem+7FKTKM0s8QE WsQKjopTYy1bSOonsadRvcsuXxUemh9h8eKsU5S5jOtQ7VoLFcXYyQ0J+xHwuu2zkgqy4RIbK72oX dUObRIdThIGYMLG6FGDyq9/6ngzeAKrAe1YCzNxA2MR5oLjUHhg7opvtcKDo0hXH2BPQw3r1NoThH 0F2jAOets3Z14RrIguS+B22lUGaHSQvpYTXxvprxSQX+vsA3tY1ubNmDK9q39SbAipGKLhuKNobcz mGTC3uNnoFjyINXLiv4Gj6IMoCkYGlzUjm5jbuqWQ5FhWcbUb+2Yh7MohSMkv7I2gPJFbO1ehv8C9 J0GVHkxg==; Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by casper.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHAH2-0007JQ-Sb for linux-mtd@lists.infradead.org; Tue, 02 Mar 2021 19:01:37 +0000 Received: by mail-lf1-x12b.google.com with SMTP id z11so32921346lfb.9 for ; Tue, 02 Mar 2021 11:01:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KMSX1uVxYWS5tl1uR5+DDAeIaBIhtR3YVV13cbow2ak=; b=HufP/ozMQu1G+FM6fmfsbawxYZn4gqt67bupLimghftv0hgkHduOlnf02tFvlcNDN/ okgm15N7uIEbLSobRqxJVKUghCrIUWIeuyBAsPKuXOeGmKBkqAhyuasJOgun4Vm0b7No f7HPT7KZiLz8jV7GPeFSFzwXAC8/3LlLmD9MY5WciS8a1WqTwG+bQpNRylMKRWnn/6gj GAqpnaTUsqjUUL1yskF79tAOU2oWm4A2h5tkUvuj4u+7aR8gdo5/tWh9UcsFTqTmnORc qQDApiI0rtQEsW/bWBJMGiZ32PpoUkYPzX1I7JDoK8XmJrRsTV2f9RuFKZn/UeuIiVT6 pY/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KMSX1uVxYWS5tl1uR5+DDAeIaBIhtR3YVV13cbow2ak=; b=YZ9dFzqoDabVP78t07MsEKeTDziT2Fzj6TPGCni6nzysHFN8rBm7h72usrKmgdifhi 03uqGlLi9IQEIYrIv790V9DDj8CgMTvVzr620J/1ATS/qjkgwr9Bqy3IPCcyRYXBKSG5 JHiZXIagB7/4jovRpP1aV9Mu+6GVaxa2btVtXobW48tM74NfNHrcLTrUvX90/pEWKMbM HBOGQTv/G6TybxMXRD0MxebB6dUslBnIWX68FcAyHSQIzAcJr9UQEzstyq18vcXGtnVe YnovuQ/TD2pYAXbm5yqFTYEeqzk/qYwlNN7gRn8kE2WnphIdT8v1gTvg20Wg5CkXd9IP OqmA== X-Gm-Message-State: AOAM530rxuUV1XsSut8vfD8LHnMDZp64l1ZsFhbYBNKVG9guj1juE0Xk 805BmAmZnwcb/mr66wvZObg= X-Google-Smtp-Source: ABdhPJxT+0VKmIOyspD7Cq+1Fcysq9AiAbgY+tnTourKXwBQKOBy2uxHvdA+2xW4YTvTUK5tPodxew== X-Received: by 2002:a05:6512:1181:: with SMTP id g1mr8189614lfr.502.1614711634491; Tue, 02 Mar 2021 11:00:34 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id x19sm587798lfr.198.2021.03.02.11.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 11:00:33 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Boris Brezillon , linux-mtd@lists.infradead.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Ansuel Smith Subject: [PATCH] mtd: parsers: ofpart: limit parsing of deprecated DT syntax Date: Tue, 2 Mar 2021 20:00:12 +0100 Message-Id: <20210302190012.1255-1-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210302_190137_942012_B144FC97 X-CRM114-Status: GOOD ( 11.85 ) X-Spam-Note: SpamAssassin invocation failed X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Rafał Miłecki For backward compatibility ofpart still supports the old syntax like: spi-flash@0 { compatible = "jedec,spi-nor"; reg = <0x0>; partition@0 { label = "bootloader"; reg = <0x0 0x100000>; }; }; (without "partitions" subnode). There is no reason however to support nested partitions without a clear "compatible" string like: partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "bootloader"; reg = <0x0 0x100000>; partition@0 { label = "config"; reg = <0x80000 0x80000>; }; }; }; (we never officially supported or documented that). Make sure ofpart doesn't attempt to parse above. Cc: Ansuel Smith Signed-off-by: Rafał Miłecki --- drivers/mtd/parsers/ofpart_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/parsers/ofpart_core.c b/drivers/mtd/parsers/ofpart_core.c index 258c06a42283..02658298d99a 100644 --- a/drivers/mtd/parsers/ofpart_core.c +++ b/drivers/mtd/parsers/ofpart_core.c @@ -53,7 +53,7 @@ static int parse_fixed_partitions(struct mtd_info *master, return 0; ofpart_node = of_get_child_by_name(mtd_node, "partitions"); - if (!ofpart_node) { + if (!ofpart_node && !master->parent) { /* * We might get here even when ofpart isn't used at all (e.g., * when using another parser), so don't be louder than @@ -64,6 +64,8 @@ static int parse_fixed_partitions(struct mtd_info *master, ofpart_node = mtd_node; dedicated = false; } + if (!ofpart_node) + return 0; of_id = of_match_node(parse_ofpart_match_table, ofpart_node); if (dedicated && !of_id) {