mirror of https://github.com/torvalds/linux.git
Randy Dunlap reports on the sparse list that sparse warns about this
expression:
of_irq->percpu ? free_percpu_irq(of_irq->irq, clkevt) :
free_irq(of_irq->irq, clkevt);
and honestly, sparse is correct to warn. The return type of
free_percpu_irq() is 'void', while free_irq() returns a 'const void *'
that is the devname argument passed in to the request_irq().
You can't mix a void type with a non-void types in a conditional
expression according to the C standard. It so happens that gcc seems to
accept it - and the resulting type of the expression is void - but
there's really no reason for the kernel to have this kind of
non-standard expression with no real upside.
The natural way to write that expression is with an if-statement:
if (of_irq->percpu)
free_percpu_irq(of_irq->irq, clkevt);
else
free_irq(of_irq->irq, clkevt);
which is more legible anyway.
I'm not sure why that timer-of code seems to have this odd pattern. It
does the same at allocation time, but at least there the types match,
and it makes sense as an expression.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
||
|---|---|---|
| .. | ||
| Kconfig | ||
| Makefile | ||
| acpi_pm.c | ||
| arc_timer.c | ||
| arm_arch_timer.c | ||
| arm_global_timer.c | ||
| armv7m_systick.c | ||
| asm9260_timer.c | ||
| bcm2835_timer.c | ||
| bcm_kona_timer.c | ||
| clksrc-dbx500-prcmu.c | ||
| clksrc_st_lpc.c | ||
| clps711x-timer.c | ||
| dummy_timer.c | ||
| dw_apb_timer.c | ||
| dw_apb_timer_of.c | ||
| em_sti.c | ||
| exynos_mct.c | ||
| h8300_timer8.c | ||
| h8300_timer16.c | ||
| h8300_tpu.c | ||
| hyperv_timer.c | ||
| i8253.c | ||
| ingenic-timer.c | ||
| jcore-pit.c | ||
| mips-gic-timer.c | ||
| mmio.c | ||
| mps2-timer.c | ||
| mxs_timer.c | ||
| nomadik-mtu.c | ||
| numachip.c | ||
| renesas-ostm.c | ||
| samsung_pwm_timer.c | ||
| scx200_hrt.c | ||
| sh_cmt.c | ||
| sh_mtu2.c | ||
| sh_tmu.c | ||
| timer-armada-370-xp.c | ||
| timer-atcpit100.c | ||
| timer-atlas7.c | ||
| timer-atmel-pit.c | ||
| timer-atmel-st.c | ||
| timer-atmel-tcb.c | ||
| timer-cadence-ttc.c | ||
| timer-cs5535.c | ||
| timer-davinci.c | ||
| timer-digicolor.c | ||
| timer-efm32.c | ||
| timer-fsl-ftm.c | ||
| timer-fttmr010.c | ||
| timer-gx6605s.c | ||
| timer-imx-gpt.c | ||
| timer-imx-sysctr.c | ||
| timer-imx-tpm.c | ||
| timer-integrator-ap.c | ||
| timer-ixp4xx.c | ||
| timer-keystone.c | ||
| timer-lpc32xx.c | ||
| timer-mediatek.c | ||
| timer-meson6.c | ||
| timer-milbeaut.c | ||
| timer-mp-csky.c | ||
| timer-npcm7xx.c | ||
| timer-nps.c | ||
| timer-of.c | ||
| timer-of.h | ||
| timer-orion.c | ||
| timer-owl.c | ||
| timer-oxnas-rps.c | ||
| timer-pistachio.c | ||
| timer-prima2.c | ||
| timer-probe.c | ||
| timer-pxa.c | ||
| timer-qcom.c | ||
| timer-rda.c | ||
| timer-riscv.c | ||
| timer-rockchip.c | ||
| timer-sp.h | ||
| timer-sp804.c | ||
| timer-sprd.c | ||
| timer-stm32.c | ||
| timer-sun4i.c | ||
| timer-sun5i.c | ||
| timer-tango-xtal.c | ||
| timer-tegra.c | ||
| timer-ti-32k.c | ||
| timer-ti-dm.c | ||
| timer-u300.c | ||
| timer-versatile.c | ||
| timer-vf-pit.c | ||
| timer-vt8500.c | ||
| timer-zevio.c | ||