lkml.org 
[lkml]   [2014]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] iio: adc: at91_adc: Correct call to input_free_device
This error handling code can be reached before st->ts_input is
initialized, so it is safer to always use the original name, input_dev.

A simplified version of the semantic match that finds this problem is:

// <smpl>
@r exists@
local idexpression struct input_dev * x;
expression ra,rr;
@@

* x = input_allocate_device(...)
... when != x = rr
when != input_free_device(x,...)
when != if (...) { ... input_free_device(x,...) ...}
if(...) { ... when != x = ra
when forall
* when != input_free_device(x,...)
\(return <+...x...+>; \| return...; \) }

// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
---
drivers/iio/adc/at91_adc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 3b5bacd..73b2bb5 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -1114,7 +1114,7 @@ static int at91_ts_register(struct at91_adc_state *st,
return ret;

err:
- input_free_device(st->ts_input);
+ input_free_device(input);
return ret;
}

--
1.9.1


\
 
 \ /
  Last update: 2014-06-14 01:21    [W:0.044 / U:0.872 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site