On 01/17/2019 11:49 PM, David Sterba wrote:
On Thu, Jan 17, 2019 at 11:32:33PM +0800, Anand Jain wrote:
Refactor btrfs_find_device() to return standard error code.
Do you intend to add more error codes?
No actually.
code like this ...
if (PTR_ERR(device) == -ENOENT)
can be
if (IS_ERR(device))
A NULL is valid in case it's
clear that it always means 'device not found'.
Oh. I am not too particular, I am ok to drop this patch.
The thought process was.. having btrfs_find_device() to return standard
err code made code at @@ -2404,8 +2404,6 @@; @@ -2419,13 +2417,9 @@;
simpler.
And as ioctls already return -ENODEV (though it might not be correct
one), so if btrfs_find_device() could return -ENODEV (instead of
-ENOENT) then there are few more places where code can be just ..
if (IS_ERR(device))
return PTR_ERR(device);
What do you think?
Thanks, Anand