All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-next] usb: typec: tcpm: tcpci: Remove the unneeded result variable
@ 2022-08-26  7:48 cgel.zte
  2022-08-26  8:13 ` Heikki Krogerus
  2022-08-26  8:36 ` Sergei Shtylyov
  0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2022-08-26  7:48 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 <zealci@zte.com.cn>
Signed-off-by: xupanda <xu.panda@zte.com.cn>
---
 drivers/usb/typec/tcpm/tcpci.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index b2bfcebe218f..4436e9e5e2f7 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,
@@ -884,5 +882,3 @@ static struct i2c_driver tcpci_i2c_driver = {
 };
 module_i2c_driver(tcpci_i2c_driver);
 
-MODULE_DESCRIPTION("USB Type-C Port Controller Interface driver");
-MODULE_LICENSE("GPL");
-- 
2.25.1


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

* Re: [PATCH linux-next] usb: typec: tcpm: tcpci: Remove the unneeded result variable
  2022-08-26  7:48 [PATCH linux-next] usb: typec: tcpm: tcpci: Remove the unneeded result variable cgel.zte
@ 2022-08-26  8:13 ` Heikki Krogerus
  2022-08-26  8:36 ` Sergei Shtylyov
  1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2022-08-26  8:13 UTC (permalink / raw)
  To: cgel.zte; +Cc: linux, gregkh, linux-usb, linux-kernel, xupanda, Zeal Robot

On Fri, Aug 26, 2022 at 07:48:57AM +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 <zealci@zte.com.cn>
> Signed-off-by: xupanda <xu.panda@zte.com.cn>
> ---
>  drivers/usb/typec/tcpm/tcpci.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index b2bfcebe218f..4436e9e5e2f7 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,
> @@ -884,5 +882,3 @@ static struct i2c_driver tcpci_i2c_driver = {
>  };
>  module_i2c_driver(tcpci_i2c_driver);
>  
> -MODULE_DESCRIPTION("USB Type-C Port Controller Interface driver");
> -MODULE_LICENSE("GPL");

Why are you removing those lines, and how is that related to the above
change?

thanks,

-- 
heikki

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

* Re: [PATCH linux-next] usb: typec: tcpm: tcpci: Remove the unneeded result variable
  2022-08-26  7:48 [PATCH linux-next] usb: typec: tcpm: tcpci: Remove the unneeded result variable cgel.zte
  2022-08-26  8:13 ` Heikki Krogerus
@ 2022-08-26  8:36 ` Sergei Shtylyov
  1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2022-08-26  8:36 UTC (permalink / raw)
  To: cgel.zte, linux
  Cc: heikki.krogerus, gregkh, linux-usb, linux-kernel, xupanda, Zeal Robot

Hello!

On 8/26/22 10:48 AM, 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 <zealci@zte.com.cn>
> Signed-off-by: xupanda <xu.panda@zte.com.cn>

   Is that a real name?

> ---
>  drivers/usb/typec/tcpm/tcpci.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index b2bfcebe218f..4436e9e5e2f7 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);

   You need to re-align this line now...

> -	return ret;
>  }
>  
>  static int tcpci_set_auto_vbus_discharge_threshold(struct tcpc_dev *dev, enum typec_pwr_opmode mode,
> @@ -884,5 +882,3 @@ static struct i2c_driver tcpci_i2c_driver = {
>  };
>  module_i2c_driver(tcpci_i2c_driver);
>  
> -MODULE_DESCRIPTION("USB Type-C Port Controller Interface driver");
> -MODULE_LICENSE("GPL");

   Hm, what's that?

MBR, Sergey

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26  7:48 [PATCH linux-next] usb: typec: tcpm: tcpci: Remove the unneeded result variable cgel.zte
2022-08-26  8:13 ` Heikki Krogerus
2022-08-26  8:36 ` Sergei Shtylyov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.