Re: [PATCH v3 3/3] intel-mid: Move boundry check to the start of init code

From: Andy Shevchenko
Date: Fri Sep 09 2016 - 07:30:52 EST


On Thu, 2016-09-08 at 19:07 -0700, Kuppuswamy Sathyanarayanan wrote:
> Moved the instance boundary check to the start of the pcal9555a
> platform init code. This will prevent unnecessary initialization
> on instance boundary error.

I don't see how it makes any better.

I would drop this patch.

>
> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@
> linux.intel.com>
> ---
> Â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;
> Â

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy