mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-12-01 00:12:36 -05:00
| Filename | Latest commit message | Latest commit date |
|---|---|---|
[ Upstream commit 213d266ebfb1621aab79cfe63388facc520a1381 ]
When compiling with -Wformat, clang emits the following warning:
gpiolib-acpi.c:393:4: warning: format specifies type 'unsigned char' but the argument has type 'int' [-Wformat]
pin);
^~~
So warning that '%hhX' is paired with an 'int' is all just completely
mindless and wrong. Sadly, I can see a different bogus warning reason
why people would want to use '%02hhX'.
Again, the *sane* thing from a human perspective is to use '%02X. But
if the compiler doesn't do any range analysis at all, it could decide
that "Oh, that print format could need up to 8 bytes of space in the
result". Using '%02hhX' would cut that down to two.
And since we use
char ev_name[5];
and currently use "_%c%02hhX" as the format string, even a compiler
that doesn't notice that "pin <= 255" test that guards this all will
go "OK, that's at most 4 bytes and the final NUL termination, so it's
fine".
While a compiler - like gcc - that only sees that the original source
of the 'pin' value is a 'unsigned short' array, and then doesn't take
the "pin <= 255" into account, will warn like this:
gpiolib-acpi.c: In function 'acpi_gpiochip_request_interrupt':
gpiolib-acpi.c:206:24: warning: '%02X' directive writing between 2 and 4 bytes into a region of size 3 [-Wformat-overflow=]
sprintf(ev_name, "_%c%02X",
^~~~
gpiolib-acpi.c:206:20: note: directive argument in the range [0, 65535]
because gcc isn't being very good at that argument range analysis either.
In other words, the original use of 'hhx' was bogus to begin with, and
due to *another* compiler warning being bad, and we had that bad code
being written back in 2016 to work around _that_ compiler warning
(commit
|
||
| .. | ||
| gpio-74x164.c | ||
| gpio-74xx-mmio.c | ||
| gpio-104-dio-48e.c | ||
| gpio-104-idi-48.c | ||
| gpio-104-idio-16.c | ||
| gpio-adnp.c | ||
| gpio-adp5520.c | ||
| gpio-adp5588.c | ||
| gpio-altera-a10sr.c | ||
| gpio-altera.c | ||
| gpio-amd-fch.c | ||
| gpio-amd8111.c | ||
| gpio-amdpt.c | ||
| gpio-arizona.c | ||
| gpio-aspeed.c | ||
| gpio-ath79.c | ||
| gpio-bcm-kona.c | ||
| gpio-bd9571mwv.c | ||
| gpio-bd70528.c | ||
| gpio-brcmstb.c | ||
| gpio-bt8xx.c | ||
| gpio-cadence.c | ||
| gpio-clps711x.c | ||
| gpio-creg-snps.c | ||
| gpio-crystalcove.c | ||
| gpio-cs5535.c | ||
| gpio-da9052.c | ||
| gpio-da9055.c | ||
| gpio-davinci.c | ||
| gpio-dln2.c | ||
| gpio-dwapb.c | ||
| gpio-eic-sprd.c | ||
| gpio-em.c | ||
| gpio-ep93xx.c | ||
| gpio-exar.c | ||
| gpio-f7188x.c | ||
| gpio-ftgpio010.c | ||
| gpio-ge.c | ||
| gpio-gpio-mm.c | ||
| gpio-grgpio.c | ||
| gpio-gw-pld.c | ||
| gpio-hlwd.c | ||
| gpio-htc-egpio.c | ||
| gpio-ich.c | ||
| gpio-intel-mid.c | ||
| gpio-iop.c | ||
| gpio-it87.c | ||
| gpio-ixp4xx.c | ||
| gpio-janz-ttl.c | ||
| gpio-kempld.c | ||
| gpio-loongson.c | ||
| gpio-loongson1.c | ||
| gpio-lp873x.c | ||
| gpio-lp3943.c | ||
| gpio-lp87565.c | ||
| gpio-lpc18xx.c | ||
| gpio-lpc32xx.c | ||
| gpio-lynxpoint.c | ||
| gpio-madera.c | ||
| gpio-max730x.c | ||
| gpio-max732x.c | ||
| gpio-max3191x.c | ||
| gpio-max7300.c | ||
| gpio-max7301.c | ||
| gpio-max77620.c | ||
| gpio-max77650.c | ||
| gpio-mb86s7x.c | ||
| gpio-mc9s08dz60.c | ||
| gpio-mc33880.c | ||
| gpio-menz127.c | ||
| gpio-merrifield.c | ||
| gpio-ml-ioh.c | ||
| gpio-mlxbf.c | ||
| gpio-mm-lantiq.c | ||
| gpio-mmio.c | ||
| gpio-mockup.c | ||
| gpio-moxtet.c | ||
| gpio-mpc8xxx.c | ||
| gpio-mpc5200.c | ||
| gpio-msic.c | ||
| gpio-mt7621.c | ||
| gpio-mvebu.c | ||
| gpio-mxc.c | ||
| gpio-mxs.c | ||
| gpio-octeon.c | ||
| gpio-omap.c | ||
| gpio-palmas.c | ||
| gpio-pca953x.c | ||
| gpio-pcf857x.c | ||
| gpio-pch.c | ||
| gpio-pci-idio-16.c | ||
| gpio-pcie-idio-24.c | ||
| gpio-pisosr.c | ||
| gpio-pl061.c | ||
| gpio-pmic-eic-sprd.c | ||
| gpio-pxa.c | ||
| gpio-raspberrypi-exp.c | ||
| gpio-rc5t583.c | ||
| gpio-rcar.c | ||
| gpio-rdc321x.c | ||
| gpio-reg.c | ||
| gpio-sa1100.c | ||
| gpio-sama5d2-piobu.c | ||
| gpio-sch.c | ||
| gpio-sch311x.c | ||
| gpio-siox.c | ||
| gpio-sodaville.c | ||
| gpio-spear-spics.c | ||
| gpio-sprd.c | ||
| gpio-sta2x11.c | ||
| gpio-stmpe.c | ||
| gpio-stp-xway.c | ||
| gpio-syscon.c | ||
| gpio-tb10x.c | ||
| gpio-tc3589x.c | ||
| gpio-tegra.c | ||
| gpio-tegra186.c | ||
| gpio-thunderx.c | ||
| gpio-timberdale.c | ||
| gpio-tpic2810.c | ||
| gpio-tps6586x.c | ||
| gpio-tps65086.c | ||
| gpio-tps65218.c | ||
| gpio-tps65910.c | ||
| gpio-tps65912.c | ||
| gpio-tps68470.c | ||
| gpio-tqmx86.c | ||
| gpio-ts4800.c | ||
| gpio-ts4900.c | ||
| gpio-ts5500.c | ||
| gpio-twl4030.c | ||
| gpio-twl6040.c | ||
| gpio-ucb1400.c | ||
| gpio-uniphier.c | ||
| gpio-vf610.c | ||
| gpio-viperboard.c | ||
| gpio-vr41xx.c | ||
| gpio-vx855.c | ||
| gpio-wcove.c | ||
| gpio-winbond.c | ||
| gpio-wm831x.c | ||
| gpio-wm8350.c | ||
| gpio-wm8994.c | ||
| gpio-ws16c48.c | ||
| gpio-xgene-sb.c | ||
| gpio-xgene.c | ||
| gpio-xilinx.c | ||
| gpio-xlp.c | ||
| gpio-xra1403.c | ||
| gpio-xtensa.c | ||
| gpio-zevio.c | ||
| gpio-zx.c | ||
| gpio-zynq.c | ||
| gpiolib-acpi.c | ||
| gpiolib-acpi.h | ||
| gpiolib-devprop.c | ||
| gpiolib-devres.c | ||
| gpiolib-legacy.c | ||
| gpiolib-of.c | ||
| gpiolib-of.h | ||
| gpiolib-sysfs.c | ||
| gpiolib.c | ||
| gpiolib.h | ||
| Kconfig | ||
| Makefile | ||
| sgpio-aspeed.c | ||
| TODO | ||