summaryrefslogtreecommitdiffstats
path: root/drivers/usb/typec
diff options
context:
space:
mode:
authorKyle Tso <kyletso@google.com>2024-03-19 15:43:09 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-03-26 14:59:13 +0100
commit53f5094fdf5deacd99b8655df692e9278506724d (patch)
tree1678a6ce5df2dda42c7d390e4f12a712b66a6987 /drivers/usb/typec
parent2a587a035214fa1b5ef598aea0b81848c5b72e5e (diff)
downloadlinux-stable-53f5094fdf5deacd99b8655df692e9278506724d.tar.gz
linux-stable-53f5094fdf5deacd99b8655df692e9278506724d.tar.bz2
linux-stable-53f5094fdf5deacd99b8655df692e9278506724d.zip
usb: typec: Return size of buffer if pd_set operation succeeds
The attribute writing should return the number of bytes used from the buffer on success. Fixes: a7cff92f0635 ("usb: typec: USB Power Delivery helpers for ports and partners") Cc: stable@vger.kernel.org Signed-off-by: Kyle Tso <kyletso@google.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20240319074309.3306579-1-kyletso@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec')
-rw-r--r--drivers/usb/typec/class.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index 389c7f0b8d93..9610e647a8d4 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -1310,6 +1310,7 @@ static ssize_t select_usb_power_delivery_store(struct device *dev,
{
struct typec_port *port = to_typec_port(dev);
struct usb_power_delivery *pd;
+ int ret;
if (!port->ops || !port->ops->pd_set)
return -EOPNOTSUPP;
@@ -1318,7 +1319,11 @@ static ssize_t select_usb_power_delivery_store(struct device *dev,
if (!pd)
return -EINVAL;
- return port->ops->pd_set(port, pd);
+ ret = port->ops->pd_set(port, pd);
+ if (ret)
+ return ret;
+
+ return size;
}
static ssize_t select_usb_power_delivery_show(struct device *dev,