Commit 013b0e96 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

init: cleanup match_dev_by_uuid and match_dev_by_label

Avoid a totally pointless goto label, and use the same style of
comparism for both helpers.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e036bb8e
......@@ -79,15 +79,10 @@ static int match_dev_by_uuid(struct device *dev, const void *data)
const struct uuidcmp *cmp = data;
struct hd_struct *part = dev_to_part(dev);
if (!part->info)
goto no_match;
if (strncasecmp(cmp->uuid, part->info->uuid, cmp->len))
goto no_match;
return 1;
no_match:
if (!part->info ||
strncasecmp(cmp->uuid, part->info->uuid, cmp->len))
return 0;
return 1;
}
/**
......@@ -174,10 +169,9 @@ static int match_dev_by_label(struct device *dev, const void *data)
const char *label = data;
struct hd_struct *part = dev_to_part(dev);
if (part->info && !strcmp(label, part->info->volname))
return 1;
if (!part->info || strcmp(label, part->info->volname))
return 0;
return 1;
}
static dev_t devt_from_partlabel(const char *label)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment