Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1453075 > unrolled thread

[PATCH 1/1] extcon: fixing compile time warning

Started byManinder Singh <maninder1.s@samsung.com>
First post2016-08-01 11:40 +0200
Last post2016-08-01 12:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] extcon: fixing compile time warning Maninder Singh <maninder1.s@samsung.com> - 2016-08-01 11:40 +0200
    Re: [PATCH 1/1] extcon: fixing compile time warning Chanwoo Choi <cw00.choi@samsung.com> - 2016-08-01 12:20 +0200

#1453075 — [PATCH 1/1] extcon: fixing compile time warning

FromManinder Singh <maninder1.s@samsung.com>
Date2016-08-01 11:40 +0200
Subject[PATCH 1/1] extcon: fixing compile time warning
Message-ID<s1hRw-4vm-27@gated-at.bofh.it>
This patch fixes below compilation warning:-
drivers/extcon/extcon.c: In function extcon_register_notifier:
drivers/extcon/extcon.c:455:6: warning: idx may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (idx >= 0) {

Signed-off-by: Vaneet Narang <v.narang@samsung.com>
Signed-off-by: Maninder Singh <maninder1.s@samsung.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 8682efc..24f04c4 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -428,7 +428,7 @@ int extcon_register_notifier(struct extcon_dev *edev, unsigned int id,
 			     struct notifier_block *nb)
 {
 	unsigned long flags;
-	int ret, idx;
+	int ret, idx = -EINVAL;
 
 	if (!nb)
 		return -EINVAL;
-- 
1.7.9.5

[toc] | [next] | [standalone]


#1453111

FromChanwoo Choi <cw00.choi@samsung.com>
Date2016-08-01 12:20 +0200
Message-ID<s1iue-500-21@gated-at.bofh.it>
In reply to#1453075
On 2016년 08월 01일 18:21, Maninder Singh wrote:
> This patch fixes below compilation warning:-
> drivers/extcon/extcon.c: In function extcon_register_notifier:
> drivers/extcon/extcon.c:455:6: warning: idx may be used uninitialized in this function [-Wmaybe-uninitialized]
>    if (idx >= 0) {
> 
> Signed-off-by: Vaneet Narang <v.narang@samsung.com>
> Signed-off-by: Maninder Singh <maninder1.s@samsung.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 8682efc..24f04c4 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -428,7 +428,7 @@ int extcon_register_notifier(struct extcon_dev *edev, unsigned int id,
>  			     struct notifier_block *nb)
>  {
>  	unsigned long flags;
> -	int ret, idx;
> +	int ret, idx = -EINVAL;
>  
>  	if (!nb)
>  		return -EINVAL;
> 

Applied it.

Thanks,
Chanwoo Choi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web