From: Andy Shevchenko Date: Tue, 15 Jun 2010 14:26:28 +0000 (+0300) Subject: ALSA: alsa: riptide: don't use own hex_to_bin() method X-Git-Tag: firefly_0821_release~9833^2~741^2~16^2~42 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=c9ff921abecda352e987a6aae169118a3fc9aa5d;p=firefly-linux-kernel-4.4.55.git ALSA: alsa: riptide: don't use own hex_to_bin() method Signed-off-by: Andy Shevchenko Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index ad4462677615..59d79962f236 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c @@ -97,6 +97,7 @@ #include #include #include +#include #include #include #include @@ -667,13 +668,12 @@ static u32 atoh(const unsigned char *in, unsigned int len) unsigned char c; while (len) { + int value; + c = in[len - 1]; - if ((c >= '0') && (c <= '9')) - sum += mult * (c - '0'); - else if ((c >= 'A') && (c <= 'F')) - sum += mult * (c - ('A' - 10)); - else if ((c >= 'a') && (c <= 'f')) - sum += mult * (c - ('a' - 10)); + value = hex_to_bin(c); + if (value >= 0) + sum += mult * value; mult *= 16; --len; }