From f470a5b01bab175dc14ac078ffe1130ae975a6fd Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Wed, 27 May 2020 11:06:25 +0200 Subject: [PATCH] staging: most: usb: use correct error codes This patch uses the -EINVAL return code where -EFAULT is wrongly being used. Signed-off-by: Christian Gromm Reported-by: Dan Carpenter Link: https://lore.kernel.org/r/1590570387-27069-9-git-send-email-christian.gromm@microchip.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/usb/usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c index 468aabfc7c4f..3575a4028039 100644 --- a/drivers/staging/most/usb/usb.c +++ b/drivers/staging/most/usb/usb.c @@ -813,7 +813,7 @@ static int get_stat_reg_addr(const struct regs *regs, int size, return 0; } } - return -EFAULT; + return -EINVAL; } #define get_static_reg_addr(regs, name, reg_addr) \ @@ -835,7 +835,7 @@ static ssize_t value_show(struct device *dev, struct device_attribute *attr, reg_addr = dci_obj->reg_addr; else if (get_static_reg_addr(ro_regs, name, ®_addr) && get_static_reg_addr(rw_regs, name, ®_addr)) - return -EFAULT; + return -EINVAL; err = drci_rd_reg(dci_obj->usb_device, reg_addr, &val); if (err < 0) @@ -870,7 +870,7 @@ static ssize_t value_store(struct device *dev, struct device_attribute *attr, else if (!get_static_reg_addr(rw_regs, name, ®_addr)) err = drci_wr_reg(usb_dev, reg_addr, val); else - return -EFAULT; + return -EINVAL; if (err < 0) return err;