Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965112AbbEMOC5 (ORCPT ); Wed, 13 May 2015 10:02:57 -0400 Received: from mail-yh0-f51.google.com ([209.85.213.51]:35600 "EHLO mail-yh0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933470AbbEMOCz (ORCPT ); Wed, 13 May 2015 10:02:55 -0400 MIME-Version: 1.0 In-Reply-To: <1429797494-29242-2-git-send-email-ricardo.ribalda@gmail.com> References: <1429797494-29242-1-git-send-email-ricardo.ribalda@gmail.com> <1429797494-29242-2-git-send-email-ricardo.ribalda@gmail.com> From: Rob Herring Date: Wed, 13 May 2015 08:56:00 -0500 Message-ID: Subject: Re: [PATCH v4 1/4] base/platform: Only insert MEM and IO resources To: Ricardo Ribalda Delgado Cc: Greg Kroah-Hartman , Grant Likely , Rob Herring , Andrew Morton , Jakub Sitnicki , Vivek Goyal , Bjorn Helgaas , Jiang Liu , Mike Travis , Thierry Reding , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2184 Lines: 60 On Thu, Apr 23, 2015 at 8:58 AM, Ricardo Ribalda Delgado wrote: > platform_device_del only checks the type of the resource in order to > call release_resource. > > On the other hand, platform_device_add calls insert_resource for any > resource that has a parent. > > Make both code branches balanced. Does this actually solve anything? What resources have parents besides mem or io? Rob > > Signed-off-by: Ricardo Ribalda Delgado > --- > drivers/base/platform.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index ebf034b..6028681 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -341,19 +341,23 @@ int platform_device_add(struct platform_device *pdev) > > for (i = 0; i < pdev->num_resources; i++) { > struct resource *p, *r = &pdev->resource[i]; > + unsigned long type = resource_type(r); > > if (r->name == NULL) > r->name = dev_name(&pdev->dev); > > + if (!(type == IORESOURCE_MEM || type == IORESOURCE_IO)) > + continue; > + > p = r->parent; > if (!p) { > - if (resource_type(r) == IORESOURCE_MEM) > + if (type == IORESOURCE_MEM) > p = &iomem_resource; > - else if (resource_type(r) == IORESOURCE_IO) > + else if (type == IORESOURCE_IO) > p = &ioport_resource; > } > > - if (p && insert_resource(p, r)) { > + if (insert_resource(p, r)) { > dev_err(&pdev->dev, "failed to claim resource %d\n", i); > ret = -EBUSY; > goto failed; > -- > 2.1.4 > -- 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/