Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wei Yongjun and committed by
Dmitry Torokhov
64b8dd29 fc4f3146

+4 -4
+4 -4
drivers/input/touchscreen/atmel_tsadcc.c
··· 183 183 struct input_dev *input_dev; 184 184 struct resource *res; 185 185 struct at91_tsadcc_data *pdata = pdev->dev.platform_data; 186 - int err = 0; 186 + int err; 187 187 unsigned int prsc; 188 188 unsigned int reg; 189 + 190 + if (!pdata) 191 + return -EINVAL; 189 192 190 193 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 191 194 if (!res) { ··· 267 264 268 265 prsc = clk_get_rate(ts_dev->clk); 269 266 dev_info(&pdev->dev, "Master clock is set at: %d Hz\n", prsc); 270 - 271 - if (!pdata) 272 - goto err_fail; 273 267 274 268 if (!pdata->adc_clock) 275 269 pdata->adc_clock = ADC_DEFAULT_CLOCK;