diff mbox series

usb: typec: tcpm: turn tcpm_ams_finish into void function

Message ID 1615184481-102148-1-git-send-email-yang.lee@linux.alibaba.com (mailing list archive)
State Superseded
Headers show
Series usb: typec: tcpm: turn tcpm_ams_finish into void function | expand

Commit Message

Yang Li March 8, 2021, 6:21 a.m. UTC
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>
---
 drivers/usb/typec/tcpm/tcpm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Guenter Roeck March 8, 2021, 6:30 a.m. UTC | #1
On 3/7/21 10:21 PM, 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>
> ---
>  drivers/usb/typec/tcpm/tcpm.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index be0b646..6ee984e 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) {
> @@ -791,7 +789,7 @@ static int tcpm_ams_finish(struct tcpm_port *port)
>  	port->in_ams = false;
>  	port->ams = NONE_AMS;
>  
> -	return ret;
> +	return;

Unnecessary return statement

Guenter

>  }
>  
>  static int tcpm_pd_transmit(struct tcpm_port *port,
>
Sergei Shtylyov March 8, 2021, 8:59 a.m. UTC | #2
Hello!

On 08.03.2021 9:21, Yang Li wrote:

> This function always return '0' and no callers use the return value.

    Returns.

> 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>
> ---
>   drivers/usb/typec/tcpm/tcpm.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index be0b646..6ee984e 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) {
> @@ -791,7 +789,7 @@ static int tcpm_ams_finish(struct tcpm_port *port)
>   	port->in_ams = false;
>   	port->ams = NONE_AMS;
>   
> -	return ret;
> +	return;

    Just remove that *return*.

>   }
[...]

MBR, Sergei
diff mbox series

Patch

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index be0b646..6ee984e 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) {
@@ -791,7 +789,7 @@  static int tcpm_ams_finish(struct tcpm_port *port)
 	port->in_ams = false;
 	port->ams = NONE_AMS;
 
-	return ret;
+	return;
 }
 
 static int tcpm_pd_transmit(struct tcpm_port *port,