public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Kyle Tso <kyletso@google.com>
Cc: linux@roeck-us.net, gregkh@linuxfoundation.org,
	badhri@google.com, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v1] usb: typec: Return size of buffer if pd_set operation succeeds
Date: Fri, 22 Mar 2024 11:47:42 +0200	[thread overview]
Message-ID: <Zf1Tvk0SeE9oxXiA@kuha.fi.intel.com> (raw)
In-Reply-To: <20240319074309.3306579-1-kyletso@google.com>

On Tue, Mar 19, 2024 at 03:43:09PM +0800, Kyle Tso wrote:
> 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: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/class.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> 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,
> -- 
> 2.44.0.291.gc1ea87d7ee-goog

-- 
heikki

      parent reply	other threads:[~2024-03-22  9:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19  7:43 [PATCH v1] usb: typec: Return size of buffer if pd_set operation succeeds Kyle Tso
2024-03-19 13:58 ` Guenter Roeck
2024-03-22  9:47 ` Heikki Krogerus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zf1Tvk0SeE9oxXiA@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox