]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fbdev: matroxfb: Mark variable with __maybe_unused to avoid W=1 build break
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 20 Mar 2026 14:36:46 +0000 (15:36 +0100)
committerHelge Deller <deller@gmx.de>
Sat, 21 Mar 2026 06:12:12 +0000 (07:12 +0100)
Clang is not happy about set but unused variable:

drivers/video/fbdev/matrox/g450_pll.c:412:18: error: variable 'mnp' set but not used
   412 |         unsigned int mnp;
       |                      ^
1 error generated.

Since the commit 7b987887f97b ("video: fbdev: matroxfb: remove dead code
and set but not used variable") the 'mnp' became unused, but eliminating
that code might have side-effects. The question here is what should we do
with 'mnp'? The easiest way out is just mark it with __maybe_unused which
will shut the compiler up and won't change any possible IO flow. So does
this change.

A dive into the history of the driver:

The problem was revealed when the #if 0 guarded code along with unused
pixel_vco variable was removed. That code was introduced in the original
commit 213d22146d1f ("[PATCH] (1/3) matroxfb for 2.5.3"). And then guarded
in the commit 705e41f82988 ("matroxfb DVI updates: Handle DVI output on
G450/G550. Powerdown unused portions of G450/G550 DAC. Split G450/G550 DAC
from older DAC1064 handling. Modify PLL setting when both CRTCs use same
pixel clocks.").

NOTE: The two commits mentioned above pre-date Git era and available in
history.git repository for archaeological purposes.

Even without that guard the modern compilers may see that the pixel_vco
wasn't ever used and seems a leftover after some debug or review made
25 years ago.

The g450_mnp2vco() doesn't have any IO and as Jason said doesn't seem
to have any side effects either than some unneeded CPU processing during
runtime. I agree that's unlikely that timeout (or heating up the CPU) has
any effect on the HW (GPU/display) functionality.

Fixes: 7b987887f97b ("video: fbdev: matroxfb: remove dead code and set but not used variable")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/matrox/g450_pll.c

index e2c1478aa47f9573e61d33d4f39d3825f2be9182..6a08f78cd1acb77082a6837c1a5419705953e6b4 100644 (file)
@@ -409,7 +409,7 @@ static int __g450_setclk(struct matrox_fb_info *minfo, unsigned int fout,
                case M_VIDEO_PLL:
                        {
                                u_int8_t tmp;
-                               unsigned int mnp;
+                               unsigned int mnp __maybe_unused;
                                unsigned long flags;
 
                                matroxfb_DAC_lock_irqsave(flags);