Skip to content

Commit f53d5aa

Browse files
andy-shevmstsirkin
authored andcommitted
virtio_blk: Use sysfs_match_string() helper
Use sysfs_match_string() helper instead of open coded variant. Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Jason Wang <jasowang@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Jason Wang <jasowang@redhat.com>
1 parent 520eccd commit f53d5aa

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/block/virtio_blk.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,9 @@ virtblk_cache_type_store(struct device *dev, struct device_attribute *attr,
541541
int i;
542542

543543
BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE));
544-
for (i = ARRAY_SIZE(virtblk_cache_types); --i >= 0; )
545-
if (sysfs_streq(buf, virtblk_cache_types[i]))
546-
break;
547-
544+
i = sysfs_match_string(virtblk_cache_types, buf);
548545
if (i < 0)
549-
return -EINVAL;
546+
return i;
550547

551548
virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i);
552549
virtblk_update_cache_mode(vdev);

0 commit comments

Comments
 (0)