diff mbox series

[v1] ata: hpt37x: Convert to use match_string() helper

Message ID 20180503212016.51582-1-andriy.shevchenko@linux.intel.com
State Not Applicable
Delegated to: David Miller
Headers show
Series [v1] ata: hpt37x: Convert to use match_string() helper | expand

Commit Message

Andy Shevchenko May 3, 2018, 9:20 p.m. UTC
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>
---
 drivers/ata/pata_hpt37x.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Tejun Heo May 7, 2018, 4:13 p.m. UTC | #1
On Fri, May 04, 2018 at 12:20:16AM +0300, Andy Shevchenko wrote:
> 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>

Applied to libata/for-4.18.

Thanks.
diff mbox series

Patch

diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index 3ba843f5cdc0..ef8aaeb0c575 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -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;
 }