Skip to content

Commit

Permalink
init: cleanup match_dev_by_uuid and match_dev_by_label
Browse files Browse the repository at this point in the history
Avoid a totally pointless goto label, and use the same style of
comparism for both helpers.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Dec 1, 2020
1 parent e036bb8 commit 013b0e9
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions init/do_mounts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

if (!part->info ||
strncasecmp(cmp->uuid, part->info->uuid, cmp->len))
return 0;
return 1;
no_match:
return 0;
}

/**
Expand Down Expand Up @@ -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;

return 0;
if (!part->info || strcmp(label, part->info->volname))
return 0;
return 1;
}

static dev_t devt_from_partlabel(const char *label)
Expand Down

0 comments on commit 013b0e9

Please sign in to comment.