Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
/* Setup each chip's output GPIOs */
htcpld->nchips = pdata->num_chip;
/* Setup each chip's output GPIOs */
htcpld->nchips = pdata->num_chip;
- htcpld->chip = kzalloc(sizeof(struct htcpld_chip) * htcpld->nchips,
- GFP_KERNEL);
+ htcpld->chip = devm_kzalloc(dev, sizeof(struct htcpld_chip) * htcpld->nchips,
+ GFP_KERNEL);
if (!htcpld->chip) {
dev_warn(dev, "Unable to allocate memory for chips\n");
return -ENOMEM;
if (!htcpld->chip) {
dev_warn(dev, "Unable to allocate memory for chips\n");
return -ENOMEM;
- htcpld = kzalloc(sizeof(struct htcpld_data), GFP_KERNEL);
+ htcpld = devm_kzalloc(dev, sizeof(struct htcpld_data), GFP_KERNEL);
if (!htcpld)
return -ENOMEM;
/* Find chained irq */
if (!htcpld)
return -ENOMEM;
/* Find chained irq */
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res) {
int flags;
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res) {
int flags;
flags, pdev->name, htcpld);
if (ret) {
dev_warn(dev, "Unable to setup chained irq handler: %d\n", ret);
flags, pdev->name, htcpld);
if (ret) {
dev_warn(dev, "Unable to setup chained irq handler: %d\n", ret);
} else
device_init_wakeup(dev, 0);
}
} else
device_init_wakeup(dev, 0);
}
/* Setup the htcpld chips */
ret = htcpld_setup_chips(pdev);
if (ret)
/* Setup the htcpld chips */
ret = htcpld_setup_chips(pdev);
if (ret)
/* Request the GPIO(s) for the int reset and set them up */
if (pdata->int_reset_gpio_hi) {
/* Request the GPIO(s) for the int reset and set them up */
if (pdata->int_reset_gpio_hi) {
dev_info(dev, "Initialized successfully\n");
return 0;
dev_info(dev, "Initialized successfully\n");
return 0;
-
-fail:
- kfree(htcpld);
- return ret;
}
/* The I2C Driver -- used internally */
}
/* The I2C Driver -- used internally */