Commit 394fc05b authored by Dan Carpenter's avatar Dan Carpenter Committed by Dmitry Torokhov

Input: cyttsp4 - leak on error path in probe()

We leak "cd" if the cd->xfer_buf allocation fails.  It was weird to
"goto error_gpio_irq" so I changed the label name.  (Label names should
reflect the label location not the goto location otherwise you get an
"all roads lead to Rome problem").
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 7c4c018a
...@@ -2025,7 +2025,7 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops, ...@@ -2025,7 +2025,7 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops,
if (!cd->xfer_buf) { if (!cd->xfer_buf) {
dev_err(dev, "%s: Error, kzalloc\n", __func__); dev_err(dev, "%s: Error, kzalloc\n", __func__);
rc = -ENOMEM; rc = -ENOMEM;
goto error_alloc_data; goto error_free_cd;
} }
/* Initialize device info */ /* Initialize device info */
...@@ -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_gpio_irq; goto error_free_cd;
} }
dev_set_drvdata(dev, cd); dev_set_drvdata(dev, cd);
...@@ -2117,7 +2117,7 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops, ...@@ -2117,7 +2117,7 @@ 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_gpio_irq: error_free_cd:
kfree(cd); kfree(cd);
error_alloc_data: error_alloc_data:
error_no_pdata: error_no_pdata:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment