linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] extcon: remove redundant assignment to variable idx
@ 2020-04-15 23:08 ` Colin King
  2020-04-17  3:05   ` Chanwoo Choi
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-04-15 23:08 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The variable idx is being initialized with a value that is never read
and it is being updated later with a new value.  The initialization is
redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/extcon/extcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 2dfbfec572f9..0a6438cbb3f3 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -900,7 +900,7 @@ int extcon_register_notifier(struct extcon_dev *edev, unsigned int id,
 			     struct notifier_block *nb)
 {
 	unsigned long flags;
-	int ret, idx = -EINVAL;
+	int ret, idx;
 
 	if (!edev || !nb)
 		return -EINVAL;
-- 
2.25.1


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

* Re: [PATCH] extcon: remove redundant assignment to variable idx
  2020-04-15 23:08 ` [PATCH] extcon: remove redundant assignment to variable idx Colin King
@ 2020-04-17  3:05   ` Chanwoo Choi
  0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2020-04-17  3:05 UTC (permalink / raw)
  To: Colin King, MyungJoo Ham; +Cc: kernel-janitors, linux-kernel

On 4/16/20 8:08 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable idx is being initialized with a value that is never read
> and it is being updated later with a new value.  The initialization is
> redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/extcon/extcon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index 2dfbfec572f9..0a6438cbb3f3 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -900,7 +900,7 @@ int extcon_register_notifier(struct extcon_dev *edev, unsigned int id,
>  			     struct notifier_block *nb)
>  {
>  	unsigned long flags;
> -	int ret, idx = -EINVAL;
> +	int ret, idx;
>  
>  	if (!edev || !nb)
>  		return -EINVAL;
> 

Applied it. Thanks.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

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

end of thread, other threads:[~2020-04-17  2:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200415230903epcas1p2bc2dd8edb6ca123086f44cb158406439@epcas1p2.samsung.com>
2020-04-15 23:08 ` [PATCH] extcon: remove redundant assignment to variable idx Colin King
2020-04-17  3:05   ` Chanwoo Choi

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).