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: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
if (!cd->xfer_buf) {
dev_err(dev, "%s: Error, kzalloc\n", __func__);
rc = -ENOMEM;
- goto error_alloc_data;
+ goto error_free_cd;
}
/* Initialize device info */
cd->irq = gpio_to_irq(cd->cpdata->irq_gpio);
if (cd->irq < 0) {
rc = -EINVAL;
- goto error_gpio_irq;
+ goto error_free_cd;
}
dev_set_drvdata(dev, cd);
if (cd->cpdata->init)
cd->cpdata->init(cd->cpdata, 0, dev);
dev_set_drvdata(dev, NULL);
-error_gpio_irq:
+error_free_cd:
kfree(cd);
error_alloc_data:
error_no_pdata: