mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH linux-next v2] usb: typec: tcpm: tcpci: Remove the unneeded result variable
@ 2022-08-26  9:17 cgel.zte
  2022-08-26 12:11 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-08-26  9:17 UTC (permalink / raw)
  To: linux
  Cc: heikki.krogerus, gregkh, linux-usb, linux-kernel, xupanda, Zeal Robot

From: xupanda <xu.panda@zte.com.cn>

Return the value regmap_update_bits() directly instead of
storing it in another redundant variable.

Reported-by: Zeal Robot <zeal@zte.com.cn>
Signed-off-by: xupanda <xu.panda@zte.com.cn>

---
change for v2
 - remove those irrelevant sentences 
---

 drivers/usb/typec/tcpm/tcpci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index b2bfcebe218f..29047da826a9 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -328,11 +328,9 @@ static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable)
 static int tcpci_enable_auto_vbus_discharge(struct tcpc_dev *dev, bool enable)
 {
 	struct tcpci *tcpci = tcpc_to_tcpci(dev);
-	int ret;
 
-	ret = regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL, TCPC_POWER_CTRL_AUTO_DISCHARGE,
+	return regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL, TCPC_POWER_CTRL_AUTO_DISCHARGE,
 				 enable ? TCPC_POWER_CTRL_AUTO_DISCHARGE : 0);
-	return ret;
 }
 
 static int tcpci_set_auto_vbus_discharge_threshold(struct tcpc_dev *dev, enum typec_pwr_opmode mode,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH linux-next v2] usb: typec: tcpm: tcpci: Remove the unneeded result variable
  2022-08-26  9:17 [PATCH linux-next v2] usb: typec: tcpm: tcpci: Remove the unneeded result variable cgel.zte
@ 2022-08-26 12:11 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2022-08-26 12:11 UTC (permalink / raw)
  To: cgel.zte
  Cc: heikki.krogerus, gregkh, linux-usb, linux-kernel, xupanda, Zeal Robot

On Fri, Aug 26, 2022 at 09:17:32AM +0000, cgel.zte@gmail.com wrote:
> From: xupanda <xu.panda@zte.com.cn>
> 
> Return the value regmap_update_bits() directly instead of
> storing it in another redundant variable.
> 
> Reported-by: Zeal Robot <zeal@zte.com.cn>
> Signed-off-by: xupanda <xu.panda@zte.com.cn>

This needs to be a real (full) name.

> 
> ---
> change for v2
>  - remove those irrelevant sentences 
> ---
> 
>  drivers/usb/typec/tcpm/tcpci.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index b2bfcebe218f..29047da826a9 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -328,11 +328,9 @@ static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable)
>  static int tcpci_enable_auto_vbus_discharge(struct tcpc_dev *dev, bool enable)
>  {
>  	struct tcpci *tcpci = tcpc_to_tcpci(dev);
> -	int ret;
>  
> -	ret = regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL, TCPC_POWER_CTRL_AUTO_DISCHARGE,
> +	return regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL, TCPC_POWER_CTRL_AUTO_DISCHARGE,
>  				 enable ? TCPC_POWER_CTRL_AUTO_DISCHARGE : 0);

Continuation line alignment still needs to be adjusted.

Both were aready mentioned in feedback to v1 of the patch.

Guenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-26 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26  9:17 [PATCH linux-next v2] usb: typec: tcpm: tcpci: Remove the unneeded result variable cgel.zte
2022-08-26 12:11 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®