From: Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx> Update the code to use devm_* API so that driver core will manage resources. Signed-off-by: Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx> --- drivers/input/touchscreen/tps6507x-ts.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index a340bfc..5bf1ec6 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c @@ -226,7 +226,7 @@ static int tps6507x_ts_probe(struct platform_device *pdev) */ init_data = tps_board->tps6507x_ts_init_data; - tsc = kzalloc(sizeof(struct tps6507x_ts), GFP_KERNEL); + tsc = devm_kzalloc(&pdev->dev, sizeof(struct tps6507x_ts), GFP_KERNEL); if (!tsc) { dev_err(tps6507x_dev->dev, "failed to allocate driver data\n"); return -ENOMEM; @@ -244,7 +244,7 @@ static int tps6507x_ts_probe(struct platform_device *pdev) if (!poll_dev) { dev_err(tsc->dev, "Failed to allocate polled input device.\n"); error = -ENOMEM; - goto err_free_mem; + goto err; } tsc->poll_dev = poll_dev; @@ -286,8 +286,7 @@ static int tps6507x_ts_probe(struct platform_device *pdev) err_free_polled_dev: input_free_polled_device(poll_dev); -err_free_mem: - kfree(tsc); +err: return error; } @@ -299,8 +298,6 @@ static int tps6507x_ts_remove(struct platform_device *pdev) input_unregister_polled_device(poll_dev); input_free_polled_device(poll_dev); - kfree(tsc); - return 0; } -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html