Commit b5dd71b2 authored by Felipe Balbi's avatar Felipe Balbi Committed by Tony Lindgren

i2c: clean add_children a bit

Clean up add_children a bit before adding more children
to twl4030-core.c
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 23ec98b6
...@@ -45,6 +45,11 @@ ...@@ -45,6 +45,11 @@
#define DRIVER_NAME "twl4030" #define DRIVER_NAME "twl4030"
#if defined(CONFIG_RTC_DRV_TWL4030) || defined(CONFIG_RTC_DRV_TWL4030_MODULE)
#define twl_has_rtc() true
#else
#define twl_has_rtc() false
#endif
/* Primary Interrupt Handler on TWL4030 Registers */ /* Primary Interrupt Handler on TWL4030 Registers */
...@@ -639,7 +644,7 @@ static int add_children(struct twl4030_platform_data *pdata) ...@@ -639,7 +644,7 @@ static int add_children(struct twl4030_platform_data *pdata)
struct twl4030_client *twl = NULL; struct twl4030_client *twl = NULL;
int status = 0; int status = 0;
#ifdef CONFIG_RTC_DRV_TWL4030 if (twl_has_rtc()) {
pdev = platform_device_alloc("twl4030_rtc", -1); pdev = platform_device_alloc("twl4030_rtc", -1);
if (pdev) { if (pdev) {
twl = &twl4030_modules[TWL4030_SLAVENUM_NUM3]; twl = &twl4030_modules[TWL4030_SLAVENUM_NUM3];
...@@ -663,10 +668,14 @@ static int add_children(struct twl4030_platform_data *pdata) ...@@ -663,10 +668,14 @@ static int add_children(struct twl4030_platform_data *pdata)
status = platform_device_add(pdev); status = platform_device_add(pdev);
if (status < 0) if (status < 0)
platform_device_put(pdev); platform_device_put(pdev);
} else } else {
status = -ENOMEM; status = -ENOMEM;
#endif goto err;
}
}
err:
pr_err("failed to add twl4030's children\n");
return status; return status;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment