lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAABMjtECX_p=G_Vwedxn3xuxm+WDy7hnyuSVc_rTNDr9yXKrYA@mail.gmail.com>
Date:   Thu, 10 Aug 2023 12:46:41 +0600
From:   Khalid Masum <khalid.masum.92@...il.com>
To:     coolrrsh@...il.com
Cc:     linus.walleij@...aro.org, brgl@...ev.pl, andy@...nel.org,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] gpio: gpio-imx-scu: Use ARRAY_SIZE for array length

On Wed, Aug 9, 2023 at 11:12 PM <coolrrsh@...il.com> wrote:
>
> From: Rajeshwar R Shinde <coolrrsh@...il.com>
>
> Use of macro ARRAY_SIZE to calculate array size minimizes
> the redundant code and improves code reusability.
> This fixes warnings reported by Coccinelle:
> drivers/gpio/gpio-imx-scu.c:106:32-33: WARNING: Use ARRAY_SIZE
>
> Signed-off-by: Rajeshwar R Shinde <coolrrsh@...il.com>
> ---
>  drivers/gpio/gpio-imx-scu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-imx-scu.c b/drivers/gpio/gpio-imx-scu.c
> index e190bde5397d..fb05a53c9712 100644
> --- a/drivers/gpio/gpio-imx-scu.c
> +++ b/drivers/gpio/gpio-imx-scu.c
> @@ -103,7 +103,7 @@ static int imx_scu_gpio_probe(struct platform_device *pdev)
>         gc = &priv->chip;
>         gc->base = -1;
>         gc->parent = dev;
> -       gc->ngpio = sizeof(scu_rsrc_arr)/sizeof(unsigned int);
> +       gc->ngpio = ARRAY_SIZE(scu_rsrc_arr)/sizeof(unsigned int);
Since ARRAY_SIZE is being used, no need to divide it with sizeof unsigned int
again.
...
 gc->ngpio = ARRAY_SIZE(scu_rsrc_arr);
...

>         gc->label = dev_name(dev);
>         gc->get = imx_scu_gpio_get;
>         gc->set = imx_scu_gpio_set;
> --
> 2.25.1

thanks,
  -- Khalid Masum

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ