usb: typec: Return size of buffer if pd_set operation succeeds
commit 53f5094fdf5deacd99b8655df692e9278506724d upstream.
The attribute writing should return the number of bytes used from the
buffer on success.
Fixes: a7cff92f06
("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>
This commit is contained in:
parent
9973107672
commit
c708b704c2
|
@ -1264,6 +1264,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;
|
||||
|
@ -1272,7 +1273,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,
|
||||
|
|
Loading…
Reference in New Issue