Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1188635lqp; Fri, 22 Mar 2024 07:57:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpCcXIr5gmtS4DvAmhRt/eSdwWTMvMYPmilE2bRFXwzkz1WuMgHBvW6tPGeczepimUC5RzMycOeskV9XumJVXdgUucZZNqbCPMrOPbwg== X-Google-Smtp-Source: AGHT+IHDFR3/UeS7gqv5q6zYd/QU2nJNPqB3qls/Wkxl4lXQMsQCPFEJ+EeRUiZq97XaKtfefQg2 X-Received: by 2002:a17:907:b9ce:b0:a46:bf6a:2a27 with SMTP id xa14-20020a170907b9ce00b00a46bf6a2a27mr1814393ejc.40.1711119429085; Fri, 22 Mar 2024 07:57:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711119429; cv=pass; d=google.com; s=arc-20160816; b=V+dTXAq4Hkcrby9VDNZpMpYv+r5Qb7FsGE70pjVcvOkvobxg/ouRIRu0bxEfrnOGPp j8uvDwUX+vUCcZWn44sSSEAbPYEpGPJb6yFIpWatDWBikSeeTni3q6yW9vtxI+IYksQt lEMssH0RFcWWKgy0gzfjRZN/p8lQ8spVG7vctE8D3ubpNe5vXD9zVQqEW0Y4Ggz5PInS YZp7YX66QSL0hUmMZ0GdxOicfPXAv1CWFQ8G21kNzK11Qrwma8Cqq7QY2WiR9U6UVEi8 tnxbxif4bmWVDhlq+rzEFI7Nb5GNi5dbQilgtMfatLw6U7ibQZhAWWpnJwD/ShH9ReZq Yywg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OetjIGvGt9ZV+sG/YHS0eRvV7s0e3HDjhxEazP4jCw8=; fh=wU/jXBYrdvZG2ZG2aDeNzJA6XXP9BCeV1NBsLDbUJxw=; b=B7pTjJFjblTn5AcS2OPLfq54NBTjmJLGr+ey5WM7fn2qW2frRs0TTqr/i7m5/U0gEf BfTU0voIEoN8Isq4woq68oe/nCU1GQTj+UU/E5ZlLuiEhhZmDjH3/wUaHeahV5WlmLMj D496Hi5ivVusefOImdNp7pn3vlbyE4gtKx61eO8Ykibk6qMys9pwSPsO8rBqwxa8yljr qz401uoittWZja7BNIvcI/XghXpNqnS1AeCUZC8430pgkQDkf0xBUtL8C/FRkVcFJMAY rwVPHuKRMKpt2VGW9P3Cba21FowyeBUh2Qwkq/GOlR4ofVBfSlLPgp0syRytm5hlwgMt 2yIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FKhkGeK6; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-111245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111245-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id jt11-20020a170906dfcb00b00a47365ba30esi352613ejc.572.2024.03.22.07.57.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 07:57:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FKhkGeK6; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-111245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111245-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 67A8C1F246AB for ; Fri, 22 Mar 2024 09:48:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DABB4224C7; Fri, 22 Mar 2024 09:47:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FKhkGeK6" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 869B022071; Fri, 22 Mar 2024 09:47:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711100868; cv=none; b=oumoXRHoNdEgY29pPSTt+dcMia+/igyvmt2QZCuKVK/RVTzN5AXB1Z0/eBiV3yuxWRStnM9d7C8dx8rrCrIy0nZ3KhAu71Rxo+qSVidpmNeGk8NQt9MT2tY1cnwCR1DJbMpIZJ9/NKIeE+bApYv+svDF2WcDtu4X5BtY0JvxJQw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711100868; c=relaxed/simple; bh=d8QI1fvrWimyZ+FSH0Pau+AvhF+Z/HjOosxcR2O3zaQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Pb3EXRYV1PnL+SV7po9WQ/Zip6J9DZNrlptRh+5rArsIMSq8UpTCVbXimmxXgvWK3ZSQBB2fHo3coL9FonhIS6V2yr5V/I7JrCtqIYLONFleaIjtZI7PWs4GBiNL88rOv9L8Ecpy5HKmcXVJC99Yek7znpla109oLsx8YjL7Rws= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=FKhkGeK6; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711100866; x=1742636866; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=d8QI1fvrWimyZ+FSH0Pau+AvhF+Z/HjOosxcR2O3zaQ=; b=FKhkGeK6EVi2iOlbZpB4g5G9kOk5gLbKHhi7brru8IjFBkleItDngykA PHE1t6ExjhQfkB097BoriziaACzYAYnG5LdXkuSnWbe3YGUGfM82SaZxc GA4OhiUARCQfCh0rizAv+Q8A96/XVGWG/yeCsjOsKe+bjYu+dG3YjIe+p tELNwp7YIz8/2CkEqKwBBMylAbNgKRtXc1Y6In1Ko/GDVdsDCSjy3ygI3 jLeJzz1ARXTgGCW4IzVp+hV4dAJqGFwsC1KMmwKKHBdc14Gk9++giF7do C47LB7/3B1RJRD6m2dQqQF+rH6U3KAAtOhEYtlfXJ3fywRB5jybbiPvTC Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="16868984" X-IronPort-AV: E=Sophos;i="6.07,145,1708416000"; d="scan'208";a="16868984" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2024 02:47:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="937066503" X-IronPort-AV: E=Sophos;i="6.07,145,1708416000"; d="scan'208";a="937066503" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 22 Mar 2024 02:47:43 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 22 Mar 2024 11:47:42 +0200 Date: Fri, 22 Mar 2024 11:47:42 +0200 From: Heikki Krogerus To: Kyle Tso 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 Message-ID: References: <20240319074309.3306579-1-kyletso@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 Reviewed-by: Heikki Krogerus > --- > 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