Commit 53f5094f authored by Kyle Tso's avatar Kyle Tso Committed by Greg Kroah-Hartman

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: a7cff92f ("usb: typec: USB Power Delivery helpers for ports and partners")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarKyle Tso <kyletso@google.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240319074309.3306579-1-kyletso@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2a587a03
...@@ -1310,6 +1310,7 @@ static ssize_t select_usb_power_delivery_store(struct device *dev, ...@@ -1310,6 +1310,7 @@ static ssize_t select_usb_power_delivery_store(struct device *dev,
{ {
struct typec_port *port = to_typec_port(dev); struct typec_port *port = to_typec_port(dev);
struct usb_power_delivery *pd; struct usb_power_delivery *pd;
int ret;
if (!port->ops || !port->ops->pd_set) if (!port->ops || !port->ops->pd_set)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -1318,7 +1319,11 @@ static ssize_t select_usb_power_delivery_store(struct device *dev, ...@@ -1318,7 +1319,11 @@ static ssize_t select_usb_power_delivery_store(struct device *dev,
if (!pd) if (!pd)
return -EINVAL; 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, static ssize_t select_usb_power_delivery_show(struct device *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