diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-05-28 03:58:19 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-06-06 01:48:52 -0400 |
commit | 64b8dd299a1344626bbcfcbd62f19f1542349ad8 (patch) | |
tree | 773cf912d59b5520b22a52cdcc3c79d567370ff5 /drivers/input | |
parent | fc4f314618923c2bef708a535f8483fa7f7dbad2 (diff) |
Input: atmel_tsadcc - fix error handing with missing platform data
If pdata is NULL, atmel_tsadcc_probe() will release all the resources
and return 0, but we need a error code is returned in this case.
Fix to return -EINVAL and move the check for pdata to the begin
of this function.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/atmel_tsadcc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c index 75a0693a3f91..bddabc595077 100644 --- a/drivers/input/touchscreen/atmel_tsadcc.c +++ b/drivers/input/touchscreen/atmel_tsadcc.c | |||
@@ -183,10 +183,13 @@ static int atmel_tsadcc_probe(struct platform_device *pdev) | |||
183 | struct input_dev *input_dev; | 183 | struct input_dev *input_dev; |
184 | struct resource *res; | 184 | struct resource *res; |
185 | struct at91_tsadcc_data *pdata = pdev->dev.platform_data; | 185 | struct at91_tsadcc_data *pdata = pdev->dev.platform_data; |
186 | int err = 0; | 186 | int err; |
187 | unsigned int prsc; | 187 | unsigned int prsc; |
188 | unsigned int reg; | 188 | unsigned int reg; |
189 | 189 | ||
190 | if (!pdata) | ||
191 | return -EINVAL; | ||
192 | |||
190 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 193 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
191 | if (!res) { | 194 | if (!res) { |
192 | dev_err(&pdev->dev, "no mmio resource defined.\n"); | 195 | dev_err(&pdev->dev, "no mmio resource defined.\n"); |
@@ -265,9 +268,6 @@ static int atmel_tsadcc_probe(struct platform_device *pdev) | |||
265 | prsc = clk_get_rate(ts_dev->clk); | 268 | prsc = clk_get_rate(ts_dev->clk); |
266 | dev_info(&pdev->dev, "Master clock is set at: %d Hz\n", prsc); | 269 | dev_info(&pdev->dev, "Master clock is set at: %d Hz\n", prsc); |
267 | 270 | ||
268 | if (!pdata) | ||
269 | goto err_fail; | ||
270 | |||
271 | if (!pdata->adc_clock) | 271 | if (!pdata->adc_clock) |
272 | pdata->adc_clock = ADC_DEFAULT_CLOCK; | 272 | pdata->adc_clock = ADC_DEFAULT_CLOCK; |
273 | 273 | ||