Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1163154

Re: [PATCH] TESTCASE: of: OOPS when disabling node via OF_DYNAMIC

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Newsgroups linux.kernel
Subject Re: [PATCH] TESTCASE: of: OOPS when disabling node via OF_DYNAMIC
Date Thu, 11 Jun 2015 13:20:02 +0200
Message-ID <pA8GC-40B-9@gated-at.bofh.it> (permalink)
References <pa67p-28m-33@gated-at.bofh.it> <pa7d8-3MI-7@gated-at.bofh.it> <pf94C-2AW-7@gated-at.bofh.it> <pi26C-8iv-11@gated-at.bofh.it> <pyMf8-5Bc-25@gated-at.bofh.it>
X-Original-To Grant Likely <grant.likely@secretlab.ca>
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=ToHhaNQ8F5H8+605SV9ZXiTtmVwpF7jwaHSE2PMN+Q8=; b=VzJBchaZru/hB/FW+vQCov7UJ2z9QzcnwZNOyywcqVERG7t0Rm8s7s8hAbhH23RZa1 20nnln8hot0vTpL5tOaZaxtscl8lNEvnYTU2LDv/VyY84lC+axbxn1snDQMM7y4RK5Fs smzWhQcVJRtwxnx9jVh3FVIA8vEsyLfE/O4kzciiq7smexs1LDf2YMD5USYQ0B+n5qwu jD2ZjosSlzODpfNlEaImffAlEY8aiFjwmP+2u7eDpIAeT1uTgZDsMnjCfANmlS/yPXZI SUtRfPKL3Z/o6fEn1ftQbilptaB59OPgbzyraAfuhVUVxb2i7RoFeXYLMgjuvxUB/4Ul 4zuQ==
X-Gm-Message-State ALoCoQkg3Vl/BedNEreEYoedy3ygUZp/7IWODgINwui3MSvhzlZOJpF3YEwbX4cUMnUhlE3il9Pq
X-Received by 10.180.108.142 with SMTP id hk14mr18087956wib.5.1434021286607; Thu, 11 Jun 2015 04:14:46 -0700 (PDT)
MIME-Version 1.0 (Mac OS X Mail 8.2 \(2098\))
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8BIT
X-Mailer Apple Mail (2.2098)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 101
Organization linux.* mail to news gateway
X-Original-Cc Wolfram Sang <wsa@the-dreams.de>, devicetree@vger.kernel.org, linux-sh@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>, Simon Horman <horms@verge.net.au>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Geert Uytterhoeven <geert@linux-m68k.org>, Rob Herring <robh+dt@kernel.org>, linux-kernel@vger.kernel.org
X-Original-Date Thu, 11 Jun 2015 14:14:41 +0300
X-Original-Message-ID <C431674C-891F-44AE-AC9E-63E910D5378A@konsulko.com>
X-Original-References <1427814771-30335-1-git-send-email-wsa@the-dreams.de> <AEA6F5CA-D520-4F34-BE6B-EF2839501089@konsulko.com> <20150414132709.GA1375@katana> <83B5C458-8D49-4EF6-9F4A-6C0E2579AB9F@konsulko.com> <20150607111632.CC7A4C410F0@trevor.secretlab.ca>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1163154

Show key headers only | View raw


Hi Grant,

> On Jun 7, 2015, at 14:16 , Grant Likely <grant.likely@secretlab.ca> wrote:
> 
> On Wed, 22 Apr 2015 15:30:28 +0300
> , Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> wrote:
>> Hi Wolfram,
>> 
>>> On Apr 14, 2015, at 16:27 , Wolfram Sang <wsa@the-dreams.de> wrote:
>>> 
>>> Hi Pantelis,
>>> 
>>> thanks for your prompt reply. Unfortunately, I had to wait until I could
>>> access the test system again.
>>> 
>> 
>> [snip]
>> 
>> Sorry for the non-prompt reply; but just for kicks, can you try the attached patch?
>> 
>> I have a hunch this might be the problem.
>> 
>> Regards
>> 
>> — Pantelis
>> 
>> 
> 
> I played around with this some today. If I'm reading it correctly, the
> following patch reproduces the same problem:
> 
> (continued below patch)
> ---
> diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
> index 18016341d5a9..0a27b38c3041 100644
> --- a/drivers/of/unittest.c
> +++ b/drivers/of/unittest.c
> @@ -753,6 +753,11 @@ static void __init of_unittest_match_node(void)
> 	}
> }
> 
> +static struct resource test_bus_res = {
> +	.start = 0xfffffff8,
> +	.end = 0xfffffff9,
> +	.flags = IORESOURCE_MEM,
> +};
> static const struct platform_device_info test_bus_info = {
> 	.name = "unittest-bus",
> };
> @@ -795,6 +800,7 @@ static void __init of_unittest_platform_populate(void)
> 	if (rc)
> 		return;
> 	test_bus->dev.of_node = np;
> +	platform_device_add_resources(test_bus, &test_bus_res, 1);
> 
> 	of_platform_populate(np, match, NULL, &test_bus->dev);
> 	for_each_child_of_node(np, child) {
> 
> ---
> 
> I think the fixup patch boils down to the following. It's hard to tell
> because it combines refactoring with the bug fix. Do I have it correct?
> If so, I'd rather commit the simple fix which can be committed now for
> v4.1, and the refactoring can be pushed for v4.2
> 
> ---
> 
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index ebf034b97278..b3042e6ee3ef 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -377,7 +377,7 @@ int platform_device_add(struct platform_device *pdev)
> 		struct resource *r = &pdev->resource[i];
> 		unsigned long type = resource_type(r);
> 
> -		if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
> +		if (r->parent)
> 			release_resource(r);
> 	}
> 
> @@ -410,7 +410,7 @@ void platform_device_del(struct platform_device *pdev)
> 			struct resource *r = &pdev->resource[i];
> 			unsigned long type = resource_type(r);
> 
> -			if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
> +			if (r->parent)
> 				release_resource(r);
> 		}
> 	}
> 

Verified. No crashes.

Acked-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] TESTCASE: of: OOPS when disabling node via OF_DYNAMIC Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2015-06-11 13:20 +0200

csiph-web