Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754415AbbFKLPE (ORCPT ); Thu, 11 Jun 2015 07:15:04 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:38280 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754377AbbFKLOs convert rfc822-to-8bit (ORCPT ); Thu, 11 Jun 2015 07:14:48 -0400 Subject: Re: [PATCH] TESTCASE: of: OOPS when disabling node via OF_DYNAMIC Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Content-Type: text/plain; charset=utf-8 From: Pantelis Antoniou In-Reply-To: <20150607111632.CC7A4C410F0@trevor.secretlab.ca> Date: Thu, 11 Jun 2015 14:14:41 +0300 Cc: Wolfram Sang , devicetree@vger.kernel.org, linux-sh@vger.kernel.org, Magnus Damm , Simon Horman , Laurent Pinchart , Geert Uytterhoeven , Rob Herring , linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: References: <1427814771-30335-1-git-send-email-wsa@the-dreams.de> <20150414132709.GA1375@katana> <83B5C458-8D49-4EF6-9F4A-6C0E2579AB9F@konsulko.com> <20150607111632.CC7A4C410F0@trevor.secretlab.ca> To: Grant Likely X-Mailer: Apple Mail (2.2098) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2907 Lines: 101 Hi Grant, > On Jun 7, 2015, at 14:16 , Grant Likely wrote: > > On Wed, 22 Apr 2015 15:30:28 +0300 > , Pantelis Antoniou > wrote: >> Hi Wolfram, >> >>> On Apr 14, 2015, at 16:27 , Wolfram Sang 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 -- 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/