Skip to content

Commit

Permalink
device property: attach 'else if' to the proper 'if'
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Andy Shevchenko authored and Rafael J. Wysocki committed Aug 25, 2015
1 parent 4f73b06 commit 7dc59dc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/acpi/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7dc59dc

Please sign in to comment.