Commit 89cd6362 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

xhci: dbc: Don't shadow error codes in store() functions

kstrtox() along with regmap API can return different error codes
based on the circumstances. Don't shadow them when returning to
the caller.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20231201150647.1307406-7-mathias.nyman@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 24352d17
...@@ -977,9 +977,11 @@ static ssize_t dbc_idVendor_store(struct device *dev, ...@@ -977,9 +977,11 @@ static ssize_t dbc_idVendor_store(struct device *dev,
void __iomem *ptr; void __iomem *ptr;
u16 value; u16 value;
u32 dev_info; u32 dev_info;
int ret;
if (kstrtou16(buf, 0, &value)) ret = kstrtou16(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
xhci = hcd_to_xhci(dev_get_drvdata(dev)); xhci = hcd_to_xhci(dev_get_drvdata(dev));
dbc = xhci->dbc; dbc = xhci->dbc;
...@@ -1017,9 +1019,11 @@ static ssize_t dbc_idProduct_store(struct device *dev, ...@@ -1017,9 +1019,11 @@ static ssize_t dbc_idProduct_store(struct device *dev,
void __iomem *ptr; void __iomem *ptr;
u32 dev_info; u32 dev_info;
u16 value; u16 value;
int ret;
if (kstrtou16(buf, 0, &value)) ret = kstrtou16(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
xhci = hcd_to_xhci(dev_get_drvdata(dev)); xhci = hcd_to_xhci(dev_get_drvdata(dev));
dbc = xhci->dbc; dbc = xhci->dbc;
...@@ -1056,9 +1060,11 @@ static ssize_t dbc_bcdDevice_store(struct device *dev, ...@@ -1056,9 +1060,11 @@ static ssize_t dbc_bcdDevice_store(struct device *dev,
void __iomem *ptr; void __iomem *ptr;
u32 dev_info; u32 dev_info;
u16 value; u16 value;
int ret;
if (kstrtou16(buf, 0, &value)) ret = kstrtou16(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
xhci = hcd_to_xhci(dev_get_drvdata(dev)); xhci = hcd_to_xhci(dev_get_drvdata(dev));
dbc = xhci->dbc; dbc = xhci->dbc;
...@@ -1098,9 +1104,13 @@ static ssize_t dbc_bInterfaceProtocol_store(struct device *dev, ...@@ -1098,9 +1104,13 @@ static ssize_t dbc_bInterfaceProtocol_store(struct device *dev,
u8 value; u8 value;
int ret; int ret;
/* bInterfaceProtocol is 8 bit, but xhci only supports values 0 and 1 */ /* bInterfaceProtocol is 8 bit, but... */
ret = kstrtou8(buf, 0, &value); ret = kstrtou8(buf, 0, &value);
if (ret || value > 1) if (ret)
return ret;
/* ...xhci only supports values 0 and 1 */
if (value > 1)
return -EINVAL; return -EINVAL;
xhci = hcd_to_xhci(dev_get_drvdata(dev)); xhci = hcd_to_xhci(dev_get_drvdata(dev));
......
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