Re: [PATCH] driver base: slience unused warning

From: Maciej W. Rozycki
Date: Fri Oct 06 2023 - 08:27:46 EST


On Thu, 5 Oct 2023, Dan Carpenter wrote:

> This is a W=1 static checker warning. We've already reviewed it, and
> marked it as old. There isn't anything else required.

Good point.

> Or are we close to promoting the unused-but-set-variable warning from
> W=1 to being on by default? How many of these warnings are remaining?
> It it's like only 20-50 warnings left then maybe we should consider the
> other options but that kind of information needs to be in the cover
> letter or otherwise we won't know about it.

Hmm, these warnings do help chasing dead code, which in turn may reveal
real issues, such as where someone missed or forgot something when writing
their code and a value that was supposed to be used somehow is instead
discarded.

Most commonly it will be the case when some code has been deliberately
removed as it evolves and a part that is no longer needed has been missed
by chance and left in place. I've seen it happen. Apart from the code
sloppiness resulting it shouldn't matter that much though as the compiler
is usually pretty good at discarding dead code.

Maciej