Skip to content

Commit

Permalink
md: don't return 0 from array_state_store
Browse files Browse the repository at this point in the history
Returning zero from a 'store' function is bad.
The return value should be either len length of the string
or an error.

So use 'len' if 'err' is zero.

Fixes: 6791875 ("md: make reconfig_mutex optional for writes to md sysfs files.")
Signed-off-by: NeilBrown <[email protected]>
Cc: [email protected] (v4.0+)
  • Loading branch information
neilbrown committed Jun 12, 2015
1 parent c65b99f commit c008f1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -3834,7 +3834,7 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len)
err = -EBUSY;
}
spin_unlock(&mddev->lock);
return err;
return err ?: len;
}
err = mddev_lock(mddev);
if (err)
Expand Down

0 comments on commit c008f1d

Please sign in to comment.