linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PNPACPI: check return value of pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data()
@ 2014-07-22 19:13 Arjun Sreedharan
  2014-07-22 22:12 ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Arjun Sreedharan @ 2014-07-22 19:13 UTC (permalink / raw)
  To: rjw; +Cc: lenb, linux-acpi, linux-kernel

Handle error condition since pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data() could return -EPERM.

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
---
 drivers/pnp/pnpacpi/core.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index b81448b..c3214e9 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -272,10 +272,14 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
 		strncpy(dev->name, acpi_device_bid(device), sizeof(dev->name));
 
 	if (dev->active)
-		pnpacpi_parse_allocated_resource(dev);
+		error = pnpacpi_parse_allocated_resource(dev);
+		if (error)
+			return error;
 
 	if (dev->capabilities & PNP_CONFIGURABLE)
-		pnpacpi_parse_resource_option_data(dev);
+		error = pnpacpi_parse_resource_option_data(dev);
+		if (error)
+			return error;
 
 	list_for_each_entry(id, &device->pnp.ids, list) {
 		if (!strcmp(id->id, pnpid))
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] PNPACPI: check return value of pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data()
  2014-07-22 19:13 [PATCH] PNPACPI: check return value of pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data() Arjun Sreedharan
@ 2014-07-22 22:12 ` Rafael J. Wysocki
  2014-07-23  8:26   ` Arjun
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2014-07-22 22:12 UTC (permalink / raw)
  To: Arjun Sreedharan; +Cc: lenb, linux-acpi, linux-kernel

On Wednesday, July 23, 2014 12:43:39 AM Arjun Sreedharan wrote:
> Handle error condition since pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data() could return -EPERM.
> 
> Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>

I wonder if this fixes any functional issue you've seen or someone has
reported to you or it's just an "Oh, we probably should handle the return
values here" kind of thing?

> ---
>  drivers/pnp/pnpacpi/core.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
> index b81448b..c3214e9 100644
> --- a/drivers/pnp/pnpacpi/core.c
> +++ b/drivers/pnp/pnpacpi/core.c
> @@ -272,10 +272,14 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
>  		strncpy(dev->name, acpi_device_bid(device), sizeof(dev->name));
>  
>  	if (dev->active)
> -		pnpacpi_parse_allocated_resource(dev);
> +		error = pnpacpi_parse_allocated_resource(dev);
> +		if (error)
> +			return error;
>  
>  	if (dev->capabilities & PNP_CONFIGURABLE)
> -		pnpacpi_parse_resource_option_data(dev);
> +		error = pnpacpi_parse_resource_option_data(dev);
> +		if (error)
> +			return error;
>  
>  	list_for_each_entry(id, &device->pnp.ids, list) {
>  		if (!strcmp(id->id, pnpid))
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PNPACPI: check return value of pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data()
  2014-07-22 22:12 ` Rafael J. Wysocki
@ 2014-07-23  8:26   ` Arjun
  2014-07-23 11:36     ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Arjun @ 2014-07-23  8:26 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, linux-kernel

ACPI 5.0 resource types like FixedDMA will fail pnpacpi_allocated_resource().
pnpacpi_add_device() has to return error in that case.

On 23 July 2014 03:42, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Wednesday, July 23, 2014 12:43:39 AM Arjun Sreedharan wrote:
>> Handle error condition since pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data() could return -EPERM.
>>
>> Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
>
> I wonder if this fixes any functional issue you've seen or someone has
> reported to you or it's just an "Oh, we probably should handle the return
> values here" kind of thing?
>
>> ---
>>  drivers/pnp/pnpacpi/core.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
>> index b81448b..c3214e9 100644
>> --- a/drivers/pnp/pnpacpi/core.c
>> +++ b/drivers/pnp/pnpacpi/core.c
>> @@ -272,10 +272,14 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
>>               strncpy(dev->name, acpi_device_bid(device), sizeof(dev->name));
>>
>>       if (dev->active)
>> -             pnpacpi_parse_allocated_resource(dev);
>> +             error = pnpacpi_parse_allocated_resource(dev);
>> +             if (error)
>> +                     return error;
>>
>>       if (dev->capabilities & PNP_CONFIGURABLE)
>> -             pnpacpi_parse_resource_option_data(dev);
>> +             error = pnpacpi_parse_resource_option_data(dev);
>> +             if (error)
>> +                     return error;
>>
>>       list_for_each_entry(id, &device->pnp.ids, list) {
>>               if (!strcmp(id->id, pnpid))
>>
>
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PNPACPI: check return value of pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data()
  2014-07-23  8:26   ` Arjun
@ 2014-07-23 11:36     ` Rafael J. Wysocki
  2014-07-23 19:49       ` Arjun Sreedharan
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2014-07-23 11:36 UTC (permalink / raw)
  To: Arjun; +Cc: Len Brown, linux-acpi, linux-kernel

On Wednesday, July 23, 2014 01:56:36 PM Arjun wrote:
> ACPI 5.0 resource types like FixedDMA will fail pnpacpi_allocated_resource().
> pnpacpi_add_device() has to return error in that case.

Why?

> On 23 July 2014 03:42, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > On Wednesday, July 23, 2014 12:43:39 AM Arjun Sreedharan wrote:
> >> Handle error condition since pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data() could return -EPERM.
> >>
> >> Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
> >
> > I wonder if this fixes any functional issue you've seen or someone has
> > reported to you or it's just an "Oh, we probably should handle the return
> > values here" kind of thing?
> >
> >> ---
> >>  drivers/pnp/pnpacpi/core.c | 8 ++++++--
> >>  1 file changed, 6 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
> >> index b81448b..c3214e9 100644
> >> --- a/drivers/pnp/pnpacpi/core.c
> >> +++ b/drivers/pnp/pnpacpi/core.c
> >> @@ -272,10 +272,14 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
> >>               strncpy(dev->name, acpi_device_bid(device), sizeof(dev->name));
> >>
> >>       if (dev->active)
> >> -             pnpacpi_parse_allocated_resource(dev);
> >> +             error = pnpacpi_parse_allocated_resource(dev);
> >> +             if (error)
> >> +                     return error;
> >>
> >>       if (dev->capabilities & PNP_CONFIGURABLE)
> >> -             pnpacpi_parse_resource_option_data(dev);
> >> +             error = pnpacpi_parse_resource_option_data(dev);
> >> +             if (error)
> >> +                     return error;
> >>
> >>       list_for_each_entry(id, &device->pnp.ids, list) {
> >>               if (!strcmp(id->id, pnpid))
> >>
> >
> > --
> > I speak only for myself.
> > Rafael J. Wysocki, Intel Open Source Technology Center.

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PNPACPI: check return value of pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data()
  2014-07-23 11:36     ` Rafael J. Wysocki
@ 2014-07-23 19:49       ` Arjun Sreedharan
  0 siblings, 0 replies; 5+ messages in thread
From: Arjun Sreedharan @ 2014-07-23 19:49 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, linux-kernel

On 23 July 2014 17:06, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Wednesday, July 23, 2014 01:56:36 PM Arjun wrote:
>> ACPI 5.0 resource types like FixedDMA will fail pnpacpi_allocated_resource().
>> pnpacpi_add_device() has to return error in that case.
>
> Why?
>

OK. I presume that for unsupported types like ACPI_RESOURCE_TYPE_FIXED_DMA
pnpacpi_set_resources() will fail.

>> On 23 July 2014 03:42, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>> > On Wednesday, July 23, 2014 12:43:39 AM Arjun Sreedharan wrote:
>> >> Handle error condition since pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data() could return -EPERM.
>> >>
>> >> Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
>> >
>> > I wonder if this fixes any functional issue you've seen or someone has
>> > reported to you or it's just an "Oh, we probably should handle the return
>> > values here" kind of thing?
>> >
>> >> ---
>> >>  drivers/pnp/pnpacpi/core.c | 8 ++++++--
>> >>  1 file changed, 6 insertions(+), 2 deletions(-)
>> >>
>> >> diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
>> >> index b81448b..c3214e9 100644
>> >> --- a/drivers/pnp/pnpacpi/core.c
>> >> +++ b/drivers/pnp/pnpacpi/core.c
>> >> @@ -272,10 +272,14 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
>> >>               strncpy(dev->name, acpi_device_bid(device), sizeof(dev->name));
>> >>
>> >>       if (dev->active)
>> >> -             pnpacpi_parse_allocated_resource(dev);
>> >> +             error = pnpacpi_parse_allocated_resource(dev);
>> >> +             if (error)
>> >> +                     return error;
>> >>
>> >>       if (dev->capabilities & PNP_CONFIGURABLE)
>> >> -             pnpacpi_parse_resource_option_data(dev);
>> >> +             error = pnpacpi_parse_resource_option_data(dev);
>> >> +             if (error)
>> >> +                     return error;
>> >>
>> >>       list_for_each_entry(id, &device->pnp.ids, list) {
>> >>               if (!strcmp(id->id, pnpid))
>> >>
>> >
>> > --
>> > I speak only for myself.
>> > Rafael J. Wysocki, Intel Open Source Technology Center.
>
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-23 19:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-22 19:13 [PATCH] PNPACPI: check return value of pnpacpi_parse_allocated_resource() and pnpacpi_parse_resource_option_data() Arjun Sreedharan
2014-07-22 22:12 ` Rafael J. Wysocki
2014-07-23  8:26   ` Arjun
2014-07-23 11:36     ` Rafael J. Wysocki
2014-07-23 19:49       ` Arjun Sreedharan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).