提交 57961e3b 编写于 作者: F Ferruh Yigit 提交者: Dmitry Torokhov

Input: cyttsp4 - kfree xfer_buf on error path in probe()

If probe() fails after cd->xfer_buf allocated, it will not freed.
Added kfree(cd->xfer_buf) with and error label.
Signed-off-by: NFerruh Yigit <fery@cypress.com>
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 9ff9f6da
...@@ -2049,7 +2049,7 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops, ...@@ -2049,7 +2049,7 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops,
cd->irq = gpio_to_irq(cd->cpdata->irq_gpio); cd->irq = gpio_to_irq(cd->cpdata->irq_gpio);
if (cd->irq < 0) { if (cd->irq < 0) {
rc = -EINVAL; rc = -EINVAL;
goto error_free_cd; goto error_free_xfer;
} }
dev_set_drvdata(dev, cd); dev_set_drvdata(dev, cd);
...@@ -2117,6 +2117,8 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops, ...@@ -2117,6 +2117,8 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops,
if (cd->cpdata->init) if (cd->cpdata->init)
cd->cpdata->init(cd->cpdata, 0, dev); cd->cpdata->init(cd->cpdata, 0, dev);
dev_set_drvdata(dev, NULL); dev_set_drvdata(dev, NULL);
error_free_xfer:
kfree(cd->xfer_buf);
error_free_cd: error_free_cd:
kfree(cd); kfree(cd);
error_alloc_data: error_alloc_data:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册