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


Groups > linux.kernel > #1204431 > unrolled thread

[PATCH v1 3/3] device property: attach 'else if' to the proper 'if'

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2015-08-10 19:00 +0200
Last post2015-08-12 14:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v1 3/3] device property: attach 'else if' to the proper 'if' Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-08-10 19:00 +0200
    Re: [PATCH v1 3/3] device property: attach 'else if' to the proper  'if' Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-08-10 19:10 +0200
    Re: [PATCH v1 3/3] device property: attach 'else if' to the proper  'if' Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-08-12 14:00 +0200

#1204431 — [PATCH v1 3/3] device property: attach 'else if' to the proper 'if'

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-08-10 19:00 +0200
Subject[PATCH v1 3/3] device property: attach 'else if' to the proper 'if'
Message-ID<pVYAx-3Ki-1@gated-at.bofh.it>
Obviously in the current place the 'else' keyword is redundant, though it seems
quite correct when we check if nval is in allowed range.

Reattach the condition branch there.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/property.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 7836e2e..a28752c 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -528,13 +528,14 @@ int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
 
 	if (!val)
 		return obj->package.count;
-	else if (nval <= 0)
-		return -EINVAL;
 
 	if (nval > obj->package.count)
 		return -EOVERFLOW;
+	else if (nval <= 0)
+		return -EINVAL;
 
 	items = obj->package.elements;
+
 	switch (proptype) {
 	case DEV_PROP_U8:
 		ret = acpi_copy_property_array_u8(items, (u8 *)val, nval);
@@ -552,8 +553,7 @@ int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
 		ret = acpi_copy_property_array_string(items, (char **)val, nval);
 		break;
 	default:
-		ret = -EINVAL;
-		break;
+		return -EINVAL;
 	}
 	return ret;
 }
-- 
2.5.0

--
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/

[toc] | [next] | [standalone]


#1204438 — Re: [PATCH v1 3/3] device property: attach 'else if' to the proper 'if'

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-08-10 19:10 +0200
SubjectRe: [PATCH v1 3/3] device property: attach 'else if' to the proper 'if'
Message-ID<pVYKf-4b1-37@gated-at.bofh.it>
In reply to#1204431
On Mon, 2015-08-10 at 19:56 +0300, Andy Shevchenko wrote:
> Obviously in the current place the 'else' keyword is redundant, 
> though it seems
> quite correct when we check if nval is in allowed range.
> 
> Reattach the condition branch there.

Rafael, it would be nice to have these fixes in 4.3 as well if you have
no objections.

One comment below.

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/acpi/property.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> index 7836e2e..a28752c 100644
> --- a/drivers/acpi/property.c
> +++ b/drivers/acpi/property.c
> @@ -528,13 +528,14 @@ int acpi_dev_prop_read(struct acpi_device 
> *adev, const char *propname,
>  
>  	if (!val)
>  		return obj->package.count;
> -	else if (nval <= 0)
> -		return -EINVAL;
>  
>  	if (nval > obj->package.count)
>  		return -EOVERFLOW;
> +	else if (nval <= 0)
> +		return -EINVAL;
>  
>  	items = obj->package.elements;
> +

This…

>  	switch (proptype) {
>  	case DEV_PROP_U8:
>  		ret = acpi_copy_property_array_u8(items, (u8 *)val, 
> nval);
> @@ -552,8 +553,7 @@ int acpi_dev_prop_read(struct acpi_device *adev, 
> const char *propname,
>  		ret = acpi_copy_property_array_string(items, (char 
> **)val, nval);
>  		break;
>  	default:
> -		ret = -EINVAL;
> -		break;
> +		return -EINVAL;

…and this seem left overs. If you wish I can resend this patch without
them.

>  	}
>  	return ret;
>  }

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
--
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/

[toc] | [prev] | [next] | [standalone]


#1205994 — Re: [PATCH v1 3/3] device property: attach 'else if' to the proper 'if'

FromMika Westerberg <mika.westerberg@linux.intel.com>
Date2015-08-12 14:00 +0200
SubjectRe: [PATCH v1 3/3] device property: attach 'else if' to the proper 'if'
Message-ID<pWCRm-3tG-55@gated-at.bofh.it>
In reply to#1204431
On Mon, Aug 10, 2015 at 07:56:48PM +0300, Andy Shevchenko wrote:
> Obviously in the current place the 'else' keyword is redundant, though it seems
> quite correct when we check if nval is in allowed range.
> 
> Reattach the condition branch there.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

When the leftovers you mentioned are dropped you can add my,

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web