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 <[email protected]>
---
 drivers/input/touchscreen/cyttsp4_core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/cyttsp4_core.c 
b/drivers/input/touchscreen/cyttsp4_core.c
index a7987e1..edcf799 100644
--- a/drivers/input/touchscreen/cyttsp4_core.c
+++ b/drivers/input/touchscreen/cyttsp4_core.c
@@ -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);
@@ -2117,6 +2117,8 @@ error_request_irq:
        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:
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to