All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] usb: typec: tcpm: turn tcpm_ams_finish into void function
@ 2021-03-08  6:35 Yang Li
  2021-03-08 11:03 ` Heikki Krogerus
  2021-03-08 18:28 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Li @ 2021-03-08  6:35 UTC (permalink / raw)
  To: linux; +Cc: heikki.krogerus, gregkh, linux-usb, linux-kernel, Yang Li

This function always return '0' and no callers use the return value.
So make it a void function.

This eliminates the following coccicheck warning:
./drivers/usb/typec/tcpm/tcpm.c:778:5-8: Unneeded variable: "ret".
Return "0" on line 794

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---

Change in v2:
-remove the unnecessary return statement

 drivers/usb/typec/tcpm/tcpm.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index be0b646..8159229 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -773,10 +773,8 @@ static enum typec_cc_status tcpm_rp_cc(struct tcpm_port *port)
 	return TYPEC_CC_RP_DEF;
 }
 
-static int tcpm_ams_finish(struct tcpm_port *port)
+static void tcpm_ams_finish(struct tcpm_port *port)
 {
-	int ret = 0;
-
 	tcpm_log(port, "AMS %s finished", tcpm_ams_str[port->ams]);
 
 	if (port->pd_capable && port->pwr_role == TYPEC_SOURCE) {
@@ -790,8 +788,6 @@ static int tcpm_ams_finish(struct tcpm_port *port)
 
 	port->in_ams = false;
 	port->ams = NONE_AMS;
-
-	return ret;
 }
 
 static int tcpm_pd_transmit(struct tcpm_port *port,
-- 
1.8.3.1


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

* Re: [PATCH v2] usb: typec: tcpm: turn tcpm_ams_finish into void function
  2021-03-08  6:35 [PATCH v2] usb: typec: tcpm: turn tcpm_ams_finish into void function Yang Li
@ 2021-03-08 11:03 ` Heikki Krogerus
  2021-03-08 18:28 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2021-03-08 11:03 UTC (permalink / raw)
  To: Yang Li; +Cc: linux, gregkh, linux-usb, linux-kernel

On Mon, Mar 08, 2021 at 02:35:30PM +0800, Yang Li wrote:
> This function always return '0' and no callers use the return value.
> So make it a void function.
> 
> This eliminates the following coccicheck warning:
> ./drivers/usb/typec/tcpm/tcpm.c:778:5-8: Unneeded variable: "ret".
> Return "0" on line 794
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> 
> Change in v2:
> -remove the unnecessary return statement
> 
>  drivers/usb/typec/tcpm/tcpm.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index be0b646..8159229 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -773,10 +773,8 @@ static enum typec_cc_status tcpm_rp_cc(struct tcpm_port *port)
>  	return TYPEC_CC_RP_DEF;
>  }
>  
> -static int tcpm_ams_finish(struct tcpm_port *port)
> +static void tcpm_ams_finish(struct tcpm_port *port)
>  {
> -	int ret = 0;
> -
>  	tcpm_log(port, "AMS %s finished", tcpm_ams_str[port->ams]);
>  
>  	if (port->pd_capable && port->pwr_role == TYPEC_SOURCE) {
> @@ -790,8 +788,6 @@ static int tcpm_ams_finish(struct tcpm_port *port)
>  
>  	port->in_ams = false;
>  	port->ams = NONE_AMS;
> -
> -	return ret;
>  }
>  
>  static int tcpm_pd_transmit(struct tcpm_port *port,
> -- 
> 1.8.3.1

-- 
heikki

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

* Re: [PATCH v2] usb: typec: tcpm: turn tcpm_ams_finish into void function
  2021-03-08  6:35 [PATCH v2] usb: typec: tcpm: turn tcpm_ams_finish into void function Yang Li
  2021-03-08 11:03 ` Heikki Krogerus
@ 2021-03-08 18:28 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2021-03-08 18:28 UTC (permalink / raw)
  To: Yang Li; +Cc: heikki.krogerus, gregkh, linux-usb, linux-kernel

On Mon, Mar 08, 2021 at 02:35:30PM +0800, Yang Li wrote:
> This function always return '0' and no callers use the return value.
> So make it a void function.
> 
> This eliminates the following coccicheck warning:
> ./drivers/usb/typec/tcpm/tcpm.c:778:5-8: Unneeded variable: "ret".
> Return "0" on line 794
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> 
> Change in v2:
> -remove the unnecessary return statement
> 
>  drivers/usb/typec/tcpm/tcpm.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index be0b646..8159229 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -773,10 +773,8 @@ static enum typec_cc_status tcpm_rp_cc(struct tcpm_port *port)
>  	return TYPEC_CC_RP_DEF;
>  }
>  
> -static int tcpm_ams_finish(struct tcpm_port *port)
> +static void tcpm_ams_finish(struct tcpm_port *port)
>  {
> -	int ret = 0;
> -
>  	tcpm_log(port, "AMS %s finished", tcpm_ams_str[port->ams]);
>  
>  	if (port->pd_capable && port->pwr_role == TYPEC_SOURCE) {
> @@ -790,8 +788,6 @@ static int tcpm_ams_finish(struct tcpm_port *port)
>  
>  	port->in_ams = false;
>  	port->ams = NONE_AMS;
> -
> -	return ret;
>  }
>  
>  static int tcpm_pd_transmit(struct tcpm_port *port,
> -- 
> 1.8.3.1
> 

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

end of thread, other threads:[~2021-03-08 18:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08  6:35 [PATCH v2] usb: typec: tcpm: turn tcpm_ams_finish into void function Yang Li
2021-03-08 11:03 ` Heikki Krogerus
2021-03-08 18:28 ` Guenter Roeck

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.