[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20231121075716.it3cpwhwymkaqjrh@pengutronix.de>
Date: Tue, 21 Nov 2023 08:57:16 +0100
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To: Markus Elfring <Markus.Elfring@....de>
Cc: Amit Dhingra <mechanicalamit@...il.com>, kernel@...gutronix.de,
kernel-janitors@...r.kernel.org, Mark Brown <broonie@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr,
linux-spi@...r.kernel.org
Subject: Re: spi: cadence-xspi: Drop useless assignment to NULL
On Tue, Nov 21, 2023 at 08:34:35AM +0100, Markus Elfring wrote:
> >>> Static structs are initialized with zeros for unspecified fields.
> >>> So there is no advantage to explicitly initialize .remove with NULL
> >>> and the assignment can be dropped without side effects.
> >>
> >> Would you become interested to delete redundant initialisation repetitions
> >> at any more source code places?
> >>
> >> A corresponding script for the semantic patch language (Coccinelle software)
> >> can point more remaining update candidates out for various components.
> >
> > Coccinelle shows 471 files.
>
> I got the impression that more source code places can be reconsidered accordingly.
>
> @deletion@
> identifier member, s, var;
> @@
> static struct s var =
> {
> ...,
> -.member = \( 0 \| NULL \) ,
> ...
> };
>
>
> Markus_Elfring@...ne:…/Projekte/Linux/next-analyses> rg '^-\s' …/Projekte/Bau/Linux/scripts/Coccinelle/delete_NULL_assignment_in_static_struct-20231117.diff | wc -l
> 6567
Removing = 0 assignments should be carefully reviewed. I skimmed the
changes to drivers/pwm and would oppose to both changes. Even for my
patch I wasn't sure if it's a good idea and talked to Mark before
sending it.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists