linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pcmcia: remvoe unneeded variable
@ 2021-11-16  2:33 cgel.zte
  2021-11-16  8:32 ` Dominik Brodowski
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-11-16  2:33 UTC (permalink / raw)
  To: linux; +Cc: ran.jianping, lee.jones, linux-kernel, Zeal Robot

From: ran jianping <ran.jianping@zte.com.cn>

Fix the following coccicheck review:
drivers/pcmcia/pcmcia_resource.c:396:5-8: Unneeded variable

Remove unneeded variable used to store return value.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: ran jianping <ran.jianping@zte.com.cn>
---
 drivers/pcmcia/pcmcia_resource.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index c1c197292111..d7e0f659d0a7 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -393,7 +393,6 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
 static int pcmcia_release_io(struct pcmcia_device *p_dev)
 {
 	struct pcmcia_socket *s = p_dev->socket;
-	int ret = -EINVAL;
 	config_t *c;
 
 	mutex_lock(&s->ops_mutex);
@@ -413,7 +412,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev)
 out:
 	mutex_unlock(&s->ops_mutex);
 
-	return ret;
+	return -EINVAL;
 } /* pcmcia_release_io */
 
 
-- 
2.25.1


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

* Re: [PATCH] pcmcia: remvoe unneeded variable
  2021-11-16  2:33 [PATCH] pcmcia: remvoe unneeded variable cgel.zte
@ 2021-11-16  8:32 ` Dominik Brodowski
  0 siblings, 0 replies; 2+ messages in thread
From: Dominik Brodowski @ 2021-11-16  8:32 UTC (permalink / raw)
  To: cgel.zte; +Cc: ran.jianping, lee.jones, linux-kernel, Zeal Robot

Am Tue, Nov 16, 2021 at 02:33:10AM +0000 schrieb cgel.zte@gmail.com:
> From: ran jianping <ran.jianping@zte.com.cn>
> 
> Fix the following coccicheck review:
> drivers/pcmcia/pcmcia_resource.c:396:5-8: Unneeded variable
> 
> Remove unneeded variable used to store return value.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: ran jianping <ran.jianping@zte.com.cn>
> ---
>  drivers/pcmcia/pcmcia_resource.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
> index c1c197292111..d7e0f659d0a7 100644
> --- a/drivers/pcmcia/pcmcia_resource.c
> +++ b/drivers/pcmcia/pcmcia_resource.c
> @@ -393,7 +393,6 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
>  static int pcmcia_release_io(struct pcmcia_device *p_dev)
>  {
>  	struct pcmcia_socket *s = p_dev->socket;
> -	int ret = -EINVAL;
>  	config_t *c;
>  
>  	mutex_lock(&s->ops_mutex);
> @@ -413,7 +412,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev)
>  out:
>  	mutex_unlock(&s->ops_mutex);
>  
> -	return ret;
> +	return -EINVAL;
>  } /* pcmcia_release_io */

Thanks for your patch. It truly points out that the return value is unused,
and in fact, the sole caller does not check it. Therefore, it seems better
to remove the return value altogether, and convert it to type void.

Thanks,
	Dominik

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

end of thread, other threads:[~2021-11-16  8:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16  2:33 [PATCH] pcmcia: remvoe unneeded variable cgel.zte
2021-11-16  8:32 ` Dominik Brodowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).