Commit 8175a01c2117e13f53b258e039f3a89c58be1425

Authored by Markus Elfring
Committed by Lee Jones
1 parent a67911d38f

mfd: twl-core: Refactoring for add_numbered_child()

Adjust jump targets according to the Linux coding style convention.
Another check for the variable "status" can be omitted then at the end.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

Showing 1 changed file with 11 additions and 10 deletions Side-by-side Diff

drivers/mfd/twl-core.c
... ... @@ -631,7 +631,7 @@
631 631 status = platform_device_add_data(pdev, pdata, pdata_len);
632 632 if (status < 0) {
633 633 dev_dbg(&pdev->dev, "can't add platform_data\n");
634   - goto err;
  634 + goto put_device;
635 635 }
636 636 }
637 637  
638 638  
639 639  
640 640  
... ... @@ -644,21 +644,22 @@
644 644 status = platform_device_add_resources(pdev, r, irq1 ? 2 : 1);
645 645 if (status < 0) {
646 646 dev_dbg(&pdev->dev, "can't add irqs\n");
647   - goto err;
  647 + goto put_device;
648 648 }
649 649 }
650 650  
651 651 status = platform_device_add(pdev);
652   - if (status == 0)
653   - device_init_wakeup(&pdev->dev, can_wakeup);
  652 + if (status)
  653 + goto put_device;
654 654  
655   -err:
656   - if (status < 0) {
657   - platform_device_put(pdev);
658   - dev_err(&twl->client->dev, "can't add %s dev\n", name);
659   - return ERR_PTR(status);
660   - }
  655 + device_init_wakeup(&pdev->dev, can_wakeup);
  656 +
661 657 return &pdev->dev;
  658 +
  659 +put_device:
  660 + platform_device_put(pdev);
  661 + dev_err(&twl->client->dev, "failed to add device %s\n", name);
  662 + return ERR_PTR(status);
662 663 }
663 664  
664 665 static inline struct device *add_child(unsigned mod_no, const char *name,