linux-stable/arch/arm/mach-davinci
Nathan Chancellor 83a1cde5c7
ARM: davinci: da850-evm: Avoid NULL pointer dereference
With newer versions of GCC, there is a panic in da850_evm_config_emac()
when booting multi_v5_defconfig in QEMU under the palmetto-bmc machine:

Unable to handle kernel NULL pointer dereference at virtual address 00000020
pgd = (ptrval)
[00000020] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 5.15.0 #1
Hardware name: Generic DT based system
PC is at da850_evm_config_emac+0x1c/0x120
LR is at do_one_initcall+0x50/0x1e0

The emac_pdata pointer in soc_info is NULL because davinci_soc_info only
gets populated on davinci machines but da850_evm_config_emac() is called
on all machines via device_initcall().

Move the rmii_en assignment below the machine check so that it is only
dereferenced when running on a supported SoC.

Fixes: bae105879f ("davinci: DA850/OMAP-L138 EVM: implement autodetect of RMII PHY")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/YcS4xVWs6bQlQSPC@archlinux-ax161/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2022-04-04 16:31:40 +02:00
..
include/mach ARM: davinci: Replace HTTP links with HTTPS ones 2020-07-21 20:21:33 +05:30
asp.h ARM: davinci: wrap HW interrupt numbers with a macro 2019-02-19 19:40:52 +05:30
board-da830-evm.c ARM: davinci: Constify the software nodes 2021-04-08 23:45:55 +02:00
board-da850-evm.c ARM: davinci: da850-evm: Avoid NULL pointer dereference 2022-04-04 16:31:40 +02:00
board-dm355-evm.c mtd: rawnand: Use the new ECC engine type enumeration 2020-09-28 15:59:42 +02:00
board-dm355-leopard.c mtd: rawnand: Use the new ECC engine type enumeration 2020-09-28 15:59:42 +02:00
board-dm365-evm.c ARM: davinci: Constify the software nodes 2021-04-08 23:45:55 +02:00
board-dm644x-evm.c ARM: davinci: Constify the software nodes 2021-04-08 23:45:55 +02:00
board-dm646x-evm.c ARM: davinci: Constify the software nodes 2021-04-08 23:45:55 +02:00
board-mityomapl138.c ARM: davinci: Constify the software nodes 2021-04-08 23:45:55 +02:00
board-neuros-osd2.c mtd: rawnand: Use the new ECC engine type enumeration 2020-09-28 15:59:42 +02:00
board-omapl138-hawk.c mtd: rawnand: Use the new ECC engine type enumeration 2020-09-28 15:59:42 +02:00
board-sffsdr.c ARM: davinci: Constify the software nodes 2021-04-08 23:45:55 +02:00
clock.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
common.c ARM: davinci: pull davinci_intc_base into the respective intc drivers 2019-02-19 19:40:38 +05:30
cpuidle.c ARM: davinci: Replace HTTP links with HTTPS ones 2020-07-21 20:21:33 +05:30
cpuidle.h ARM: davinci: Replace HTTP links with HTTPS ones 2020-07-21 20:21:33 +05:30
da8xx-dt.c ARM: davinci: Replace HTTP links with HTTPS ones 2020-07-21 20:21:33 +05:30
da830.c ARM: davinci: da830: switch to using the clocksource driver 2019-08-08 00:22:49 +05:30
da850.c ARM: davinci: Replace HTTP links with HTTPS ones 2020-07-21 20:21:33 +05:30
davinci.h ARM: davinci: move timer definitions to davinci.h 2019-08-08 00:22:49 +05:30
ddr2.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
devices-da8xx.c dma-mapping: merge <linux/dma-contiguous.h> into <linux/dma-map-ops.h> 2020-10-06 07:07:04 +02:00
devices.c ARM: SoC: late updates 2020-02-08 14:17:27 -08:00
dm355.c ARM: davinci: dm355: switch to using the clocksource driver 2019-08-08 00:22:49 +05:30
dm365.c ARM: davinci: dm365: switch to using the clocksource driver 2020-01-13 13:20:00 +05:30
dm644x.c ARM: davinci: dm644x: switch to using the clocksource driver 2019-08-26 17:49:07 +05:30
dm646x.c ARM: davinci: dm646x: Fix a typo in the comment 2019-08-26 17:51:28 +05:30
irqs.h ARM: davinci: make irqs.h a local header 2019-02-19 19:44:02 +05:30
Kconfig arch: Kconfig: clean up obsolete use of HAVE_IDE 2021-07-30 08:19:09 -06:00
Makefile ARM: davinci: remove legacy timer support 2020-01-13 13:20:00 +05:30
Makefile.boot License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mux.c
mux.h
pdata-quirks.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pm.c ARM: davinci: Replace HTTP links with HTTPS ones 2020-07-21 20:21:33 +05:30
pm_domain.c ARM: davinci: da8xx-dt: switch to device tree clocks 2018-06-26 16:20:03 +05:30
psc.h ARM: davinci: remove legacy clocks 2018-06-26 16:15:55 +05:30
serial.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
sleep.S ARM: davinci: Replace HTTP links with HTTPS ones 2020-07-21 20:21:33 +05:30
sram.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sram.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
usb-da8xx.c ARM: davinci: make irqs.h a local header 2019-02-19 19:44:02 +05:30
usb.c ARM: davinci: make irqs.h a local header 2019-02-19 19:44:02 +05:30