[PATCH RFC] regulator: mt6380: Fix unused array warning

Jean Delvare jdelvare at suse.de
Fri Jul 29 06:23:49 PDT 2022


On Thu, 28 Jul 2022 13:15:14 +0200, AngeloGioacchino Del Regno wrote:
> Il 27/07/22 13:26, Jean Delvare ha scritto:
> > With the following configuration options:
> > CONFIG_OF is not set
> > CONFIG_REGULATOR_MT6380=y
> > we get the following build warning:
> > 
> >    CC      drivers/regulator/mt6380-regulator.o
> > drivers/regulator/mt6380-regulator.c:322:34: warning: ‘mt6380_of_match’ defined but not used [-Wunused-const-variable=]
> > 
> > Fix this by annotating that array with __maybe_unused, as done in
> > various regulator drivers.  
> 
> I know I'm late to the party, but I would've preferred to see the
> of_match_ptr() dropped instead of adding a __maybe_unused.

Doing that for this driver would basically prevent the compiler from
dropping out the variable in the !CONFIG_OF case. If this is a valid
case (and I really would like Mediatek people to comment on that) then
I can't see how that would be an improvement.

-- 
Jean Delvare
SUSE L3 Support



More information about the Linux-mediatek mailing list