Commit 5e3b8a8d authored by Damien Le Moal's avatar Damien Le Moal Committed by Song Liu

md: Fix compilation warning

Remove the if statement around the calls to sysfs_link_rdev() to avoid
the compilation warnings:

warning: suggest braces around empty body in an ‘if’ statement

when compiling with W=1. For the call to sysfs_create_link() generating
the same warning, use the err variable to store the function result,
avoiding triggering another warning as the function is declared
as 'warn_unused_result'.
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
parent 659bf827
...@@ -2469,8 +2469,8 @@ static int bind_rdev_to_array(struct md_rdev *rdev, struct mddev *mddev) ...@@ -2469,8 +2469,8 @@ static int bind_rdev_to_array(struct md_rdev *rdev, struct mddev *mddev)
goto fail; goto fail;
ko = &part_to_dev(rdev->bdev->bd_part)->kobj; ko = &part_to_dev(rdev->bdev->bd_part)->kobj;
if (sysfs_create_link(&rdev->kobj, ko, "block")) /* failure here is OK */
/* failure here is OK */; err = sysfs_create_link(&rdev->kobj, ko, "block");
rdev->sysfs_state = sysfs_get_dirent_safe(rdev->kobj.sd, "state"); rdev->sysfs_state = sysfs_get_dirent_safe(rdev->kobj.sd, "state");
rdev->sysfs_unack_badblocks = rdev->sysfs_unack_badblocks =
sysfs_get_dirent_safe(rdev->kobj.sd, "unacknowledged_bad_blocks"); sysfs_get_dirent_safe(rdev->kobj.sd, "unacknowledged_bad_blocks");
...@@ -3238,8 +3238,8 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len) ...@@ -3238,8 +3238,8 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len)
return err; return err;
} else } else
sysfs_notify_dirent_safe(rdev->sysfs_state); sysfs_notify_dirent_safe(rdev->sysfs_state);
if (sysfs_link_rdev(rdev->mddev, rdev)) /* failure here is OK */;
/* failure here is OK */; sysfs_link_rdev(rdev->mddev, rdev);
/* don't wakeup anyone, leave that to userspace. */ /* don't wakeup anyone, leave that to userspace. */
} else { } else {
if (slot >= rdev->mddev->raid_disks && if (slot >= rdev->mddev->raid_disks &&
...@@ -9113,8 +9113,8 @@ static int remove_and_add_spares(struct mddev *mddev, ...@@ -9113,8 +9113,8 @@ static int remove_and_add_spares(struct mddev *mddev,
rdev->recovery_offset = 0; rdev->recovery_offset = 0;
} }
if (mddev->pers->hot_add_disk(mddev, rdev) == 0) { if (mddev->pers->hot_add_disk(mddev, rdev) == 0) {
if (sysfs_link_rdev(mddev, rdev)) /* failure here is OK */
/* failure here is OK */; sysfs_link_rdev(mddev, rdev);
if (!test_bit(Journal, &rdev->flags)) if (!test_bit(Journal, &rdev->flags))
spares++; spares++;
md_new_event(mddev); md_new_event(mddev);
......
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