diff mbox series

[2/4] lightnvm: return the correct return value

Message ID 20210413105257.159260-3-matias.bjorling@wdc.com (mailing list archive)
State New
Headers show
Series lightnvm pull request | expand

Commit Message

Matias Bjørling April 13, 2021, 10:52 a.m. UTC
From: Tian Tao <tiantao6@hisilicon.com>

When memdup_user returns an error, memdup_user has two different return
values, use PTR_ERR to get the correct return value.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Matias Bjørling <matias.bjorling@wdc.com>
 drivers/lightnvm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 28ddcaa5358b..42774beeba94 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -1257,7 +1257,7 @@  static long nvm_ioctl_info(struct file *file, void __user *arg)
 	info = memdup_user(arg, sizeof(struct nvm_ioctl_info));
 	if (IS_ERR(info))
-		return -EFAULT;
+		return PTR_ERR(info);
 	info->version[0] = NVM_VERSION_MAJOR;
 	info->version[1] = NVM_VERSION_MINOR;