Skip to content

Commit

Permalink
Input: cyttsp4 - kfree xfer_buf on error path in probe()
Browse files Browse the repository at this point in the history
If probe() fails after cd->xfer_buf allocated, it will not freed.
Added kfree(cd->xfer_buf) with and error label.

Signed-off-by: Ferruh Yigit <fery@cypress.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Ferruh Yigit authored and Dmitry Torokhov committed Jul 4, 2013
1 parent 9ff9f6d commit 57961e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/input/touchscreen/cyttsp4_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2049,7 +2049,7 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops,
cd->irq = gpio_to_irq(cd->cpdata->irq_gpio);
if (cd->irq < 0) {
rc = -EINVAL;
goto error_free_cd;
goto error_free_xfer;
}

dev_set_drvdata(dev, cd);
Expand Down Expand Up @@ -2117,6 +2117,8 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops,
if (cd->cpdata->init)
cd->cpdata->init(cd->cpdata, 0, dev);
dev_set_drvdata(dev, NULL);
error_free_xfer:
kfree(cd->xfer_buf);
error_free_cd:
kfree(cd);
error_alloc_data:
Expand Down

0 comments on commit 57961e3

Please sign in to comment.