ata: hpt37x: Convert to use match_string() helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 3 May 2018 21:20:16 +0000 (00:20 +0300)
committerTejun Heo <tj@kernel.org>
Mon, 7 May 2018 15:50:30 +0000 (08:50 -0700)
The new helper returns index of the matching string in an array.
We are going to use it here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/pata_hpt37x.c

index 3ba843f5cdc0f91a789e536b876a0b4bb292e645..ef8aaeb0c575a00cb549c1e004800f14c7744df1 100644 (file)
@@ -224,17 +224,14 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
                               const char * const list[])
 {
        unsigned char model_num[ATA_ID_PROD_LEN + 1];
-       int i = 0;
+       int i;
 
        ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
 
-       while (list[i] != NULL) {
-               if (!strcmp(list[i], model_num)) {
-                       pr_warn("%s is not supported for %s\n",
-                               modestr, list[i]);
-                       return 1;
-               }
-               i++;
+       i = match_string(list, -1, model_num);
+       if (i >= 0) {
+               pr_warn("%s is not supported for %s\n", modestr, list[i]);
+               return 1;
        }
        return 0;
 }