summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/htc-i2cpld.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/htc-i2cpld.c')
-rw-r--r--drivers/mfd/htc-i2cpld.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c
index 324187c0c124..c9dfce6ae0c2 100644
--- a/drivers/mfd/htc-i2cpld.c
+++ b/drivers/mfd/htc-i2cpld.c
@@ -514,8 +514,8 @@ static int htcpld_setup_chips(struct platform_device *pdev)
514 514
515 /* Setup each chip's output GPIOs */ 515 /* Setup each chip's output GPIOs */
516 htcpld->nchips = pdata->num_chip; 516 htcpld->nchips = pdata->num_chip;
517 htcpld->chip = kzalloc(sizeof(struct htcpld_chip) * htcpld->nchips, 517 htcpld->chip = devm_kzalloc(dev, sizeof(struct htcpld_chip) * htcpld->nchips,
518 GFP_KERNEL); 518 GFP_KERNEL);
519 if (!htcpld->chip) { 519 if (!htcpld->chip) {
520 dev_warn(dev, "Unable to allocate memory for chips\n"); 520 dev_warn(dev, "Unable to allocate memory for chips\n");
521 return -ENOMEM; 521 return -ENOMEM;
@@ -580,12 +580,11 @@ static int htcpld_core_probe(struct platform_device *pdev)
580 return -ENXIO; 580 return -ENXIO;
581 } 581 }
582 582
583 htcpld = kzalloc(sizeof(struct htcpld_data), GFP_KERNEL); 583 htcpld = devm_kzalloc(dev, sizeof(struct htcpld_data), GFP_KERNEL);
584 if (!htcpld) 584 if (!htcpld)
585 return -ENOMEM; 585 return -ENOMEM;
586 586
587 /* Find chained irq */ 587 /* Find chained irq */
588 ret = -EINVAL;
589 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 588 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
590 if (res) { 589 if (res) {
591 int flags; 590 int flags;
@@ -598,7 +597,7 @@ static int htcpld_core_probe(struct platform_device *pdev)
598 flags, pdev->name, htcpld); 597 flags, pdev->name, htcpld);
599 if (ret) { 598 if (ret) {
600 dev_warn(dev, "Unable to setup chained irq handler: %d\n", ret); 599 dev_warn(dev, "Unable to setup chained irq handler: %d\n", ret);
601 goto fail; 600 return ret;
602 } else 601 } else
603 device_init_wakeup(dev, 0); 602 device_init_wakeup(dev, 0);
604 } 603 }
@@ -609,7 +608,7 @@ static int htcpld_core_probe(struct platform_device *pdev)
609 /* Setup the htcpld chips */ 608 /* Setup the htcpld chips */
610 ret = htcpld_setup_chips(pdev); 609 ret = htcpld_setup_chips(pdev);
611 if (ret) 610 if (ret)
612 goto fail; 611 return ret;
613 612
614 /* Request the GPIO(s) for the int reset and set them up */ 613 /* Request the GPIO(s) for the int reset and set them up */
615 if (pdata->int_reset_gpio_hi) { 614 if (pdata->int_reset_gpio_hi) {
@@ -644,10 +643,6 @@ static int htcpld_core_probe(struct platform_device *pdev)
644 643
645 dev_info(dev, "Initialized successfully\n"); 644 dev_info(dev, "Initialized successfully\n");
646 return 0; 645 return 0;
647
648fail:
649 kfree(htcpld);
650 return ret;
651} 646}
652 647
653/* The I2C Driver -- used internally */ 648/* The I2C Driver -- used internally */