Re: [PATCH] staging: vt6656: Use ARRAY_SIZE instead of hardcoded size
From: Dan Carpenter
Date: Tue Mar 17 2020 - 06:45:34 EST
On Sat, Mar 14, 2020 at 05:47:54PM +0100, Oscar Carter wrote:
> Use ARRAY_SIZE to replace the hardcoded size so we will never have a
> mismatch.
>
> Signed-off-by: Oscar Carter <oscar.carter@xxxxxxx>
> ---
> drivers/staging/vt6656/main_usb.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
> index 5e48b3ddb94c..4370941ffc04 100644
> --- a/drivers/staging/vt6656/main_usb.c
> +++ b/drivers/staging/vt6656/main_usb.c
> @@ -23,6 +23,7 @@
>
> #include <linux/etherdevice.h>
> #include <linux/file.h>
> +#include <linux/kernel.h>
> #include "device.h"
> #include "card.h"
> #include "baseband.h"
> @@ -116,6 +117,7 @@ static int vnt_init_registers(struct vnt_private *priv)
> int ii;
> u8 tmp;
> u8 calib_tx_iq = 0, calib_tx_dc = 0, calib_rx_iq = 0;
> + const int n_cck_pwr_tbl = ARRAY_SIZE(priv->cck_pwr_tbl);
Please use ARRAY_SIZE(priv->cck_pwr_tbl) everywhere instead of
introducing this new variable.
regards,
dan carpenter