[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210712130520.748b6e3a@hermes.local>
Date: Mon, 12 Jul 2021 13:05:20 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Salah Triki <salah.triki@...il.com>
Cc: kevin.curtis@...site.co.uk, davem@...emloft.net, kuba@...nel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] replace for loop with array initializer
On Mon, 12 Jul 2021 20:24:50 +0100
Salah Triki <salah.triki@...il.com> wrote:
> diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
> index b3466e084e84..a90d3b9a8170 100644
> --- a/drivers/net/wan/farsync.c
> +++ b/drivers/net/wan/farsync.c
> @@ -567,7 +567,7 @@ static void fst_process_int_work_q(struct tasklet_struct *unused);
> static DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q);
> static DECLARE_TASKLET(fst_int_task, fst_process_int_work_q);
>
> -static struct fst_card_info *fst_card_array[FST_MAX_CARDS];
> +static struct fst_card_info *fst_card_array[FST_MAX_CARDS] = { [0 ... FST_MAX_CARDS-1] = NULL };
Why bother, the default initialization in C is 0 (ie. NULL).
In fact, checkpatch should complain about useless array initialization for this.
Powered by blists - more mailing lists