diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2016-06-26 07:03:59 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2016-06-29 05:16:16 -0400 |
commit | 8175a01c2117e13f53b258e039f3a89c58be1425 (patch) | |
tree | ce914552277acbace6baa7cd5529e5d39812a2d3 | |
parent | a67911d38f2deda8a48cb0e8a4b3f59afeda7b81 (diff) |
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>
-rw-r--r-- | drivers/mfd/twl-core.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 9458c6df39ed..a49d3db6d936 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
@@ -631,7 +631,7 @@ add_numbered_child(unsigned mod_no, const char *name, int num, | |||
631 | status = platform_device_add_data(pdev, pdata, pdata_len); | 631 | status = platform_device_add_data(pdev, pdata, pdata_len); |
632 | if (status < 0) { | 632 | if (status < 0) { |
633 | dev_dbg(&pdev->dev, "can't add platform_data\n"); | 633 | dev_dbg(&pdev->dev, "can't add platform_data\n"); |
634 | goto err; | 634 | goto put_device; |
635 | } | 635 | } |
636 | } | 636 | } |
637 | 637 | ||
@@ -644,21 +644,22 @@ add_numbered_child(unsigned mod_no, const char *name, int num, | |||
644 | status = platform_device_add_resources(pdev, r, irq1 ? 2 : 1); | 644 | status = platform_device_add_resources(pdev, r, irq1 ? 2 : 1); |
645 | if (status < 0) { | 645 | if (status < 0) { |
646 | dev_dbg(&pdev->dev, "can't add irqs\n"); | 646 | dev_dbg(&pdev->dev, "can't add irqs\n"); |
647 | goto err; | 647 | goto put_device; |
648 | } | 648 | } |
649 | } | 649 | } |
650 | 650 | ||
651 | status = platform_device_add(pdev); | 651 | status = platform_device_add(pdev); |
652 | if (status == 0) | 652 | if (status) |
653 | device_init_wakeup(&pdev->dev, can_wakeup); | 653 | goto put_device; |
654 | |||
655 | device_init_wakeup(&pdev->dev, can_wakeup); | ||
654 | 656 | ||
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 | } | ||
661 | return &pdev->dev; | 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 | static inline struct device *add_child(unsigned mod_no, const char *name, | 665 | static inline struct device *add_child(unsigned mod_no, const char *name, |