]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ALSA: oxfw: use match_string() helper
authorYisheng Xie <xieyisheng1@huawei.com>
Mon, 21 May 2018 11:58:06 +0000 (19:58 +0800)
committerTakashi Iwai <tiwai@suse.de>
Tue, 22 May 2018 07:25:42 +0000 (09:25 +0200)
match_string() returns the index of an array for a matching string,
which can be used intead of open coded variant.

Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/oxfw/oxfw.c

index 413ab6313bb66515c284734ca92c87bef014c5fd..1e5b2c8026355d9b788843e29990043249065b02 100644 (file)
@@ -49,7 +49,6 @@ static bool detect_loud_models(struct fw_unit *unit)
                "Tapco LINK.firewire 4x6",
                "U.420"};
        char model[32];
-       unsigned int i;
        int err;
 
        err = fw_csr_string(unit->directory, CSR_MODEL,
@@ -57,12 +56,7 @@ static bool detect_loud_models(struct fw_unit *unit)
        if (err < 0)
                return false;
 
-       for (i = 0; i < ARRAY_SIZE(models); i++) {
-               if (strcmp(models[i], model) == 0)
-                       break;
-       }
-
-       return (i < ARRAY_SIZE(models));
+       return match_string(models, ARRAY_SIZE(models), model) >= 0;
 }
 
 static int name_card(struct snd_oxfw *oxfw)