summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpi_pnp.c
diff options
context:
space:
mode:
authorArjun Sreedharan <arjun024@gmail.com>2014-07-31 14:34:49 +0530
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-31 23:07:48 +0200
commita5f95da9fb2a0b228b3bab19d35850af3e9a74b2 (patch)
tree63bdcdd801197edef580d755626d929d021bc872 /drivers/acpi/acpi_pnp.c
parentfeb41bb1ca6b969985cd5e486a3f2deac9f089fa (diff)
downloadop-kernel-dev-a5f95da9fb2a0b228b3bab19d35850af3e9a74b2.zip
op-kernel-dev-a5f95da9fb2a0b228b3bab19d35850af3e9a74b2.tar.gz
ACPI / PNP: Replace faulty is_hex_digit() by isxdigit()
0 is ascii for NULL. Hex digit matching should be from '0'. Faulty version returns true for #,$,%,& etc. Signed-off-by: Arjun Sreedharan <arjun024@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpi_pnp.c')
-rw-r--r--drivers/acpi/acpi_pnp.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
index 4ddb0dc..996fa19 100644
--- a/drivers/acpi/acpi_pnp.c
+++ b/drivers/acpi/acpi_pnp.c
@@ -12,6 +12,7 @@
#include <linux/acpi.h>
#include <linux/module.h>
+#include <linux/ctype.h>
static const struct acpi_device_id acpi_pnp_device_ids[] = {
/* soc_button_array */
@@ -320,11 +321,6 @@ static const struct acpi_device_id acpi_pnp_device_ids[] = {
{""},
};
-static bool is_hex_digit(char c)
-{
- return (c >= 0 && c <= '9') || (c >= 'A' && c <= 'F');
-}
-
static bool matching_id(char *idstr, char *list_id)
{
int i;
@@ -335,7 +331,7 @@ static bool matching_id(char *idstr, char *list_id)
for (i = 3; i < 7; i++) {
char c = toupper(idstr[i]);
- if (!is_hex_digit(c)
+ if (!isxdigit(c)
|| (list_id[i] != 'X' && c != toupper(list_id[i])))
return false;
}
OpenPOWER on IntegriCloud