Moved the instance boundary check to the start of the pcal9555a platform init code. This will prevent unnecessary initialization on instance boundary error. Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx> --- arch/x86/platform/intel-mid/device_libs/platform_pcal9555a.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/platform/intel-mid/device_libs/platform_pcal9555a.c b/arch/x86/platform/intel-mid/device_libs/platform_pcal9555a.c index cde764e..4e5dd95 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_pcal9555a.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_pcal9555a.c @@ -34,6 +34,12 @@ static void __init *pcal9555a_platform_data(void *info) char intr_pin_name[SFI_NAME_LEN + 1]; int gpio_base, intr; + if (nr >= PCAL9555A_NUM) { + pr_err("%s: Too many instances, only %d supported\n", __func__, + PCAL9555A_NUM); + return ERR_PTR(-ENOMEM); + } + snprintf(base_pin_name, sizeof(base_pin_name), "%s_base", type); snprintf(intr_pin_name, sizeof(intr_pin_name), "%s_int", type); @@ -47,12 +53,6 @@ static void __init *pcal9555a_platform_data(void *info) return NULL; } - if (nr >= PCAL9555A_NUM) { - pr_err("%s: Too many instances, only %d supported\n", __func__, - PCAL9555A_NUM); - return ERR_PTR(-ENOMEM); - } - pcal9555a = &pcal9555a_pdata[nr++]; pcal9555a->gpio_base = gpio_base; -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html