Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: BCM63XX: drop unused and broken DSP platform device

Trying to register the DSP platform device results in a null pointer
access:

[ 0.124184] CPU 0 Unable to handle kernel paging request at virtual address 00000000, epc == 804e305c, ra == 804e6f20
[ 0.135208] Oops[#1]:
[ 0.137514] CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.87
...
[ 0.197117] epc : 804e305c bcm63xx_dsp_register+0x80/0xa4
[ 0.202838] ra : 804e6f20 board_register_devices+0x258/0x390
...

This happens because it tries to copy the passed platform data over the
platform_device's unpopulated platform_data.

Since this code has been broken since its submission, no driver was ever
submitted for it, and apparently nobody was using it, just remove it
instead of trying to fix it.

Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>

authored by

Jonas Gorski and committed by
Paul Burton
682fee80 d025bff1

+3 -98
+3 -3
arch/mips/bcm63xx/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ 3 - setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ 4 - dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \ 5 - dev-wdt.o dev-usb-usbd.o 3 + setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ 4 + dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o dev-wdt.o \ 5 + dev-usb-usbd.o 6 6 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 7 7 8 8 obj-y += boards/
-20
arch/mips/bcm63xx/boards/board_bcm963xx.c
··· 23 23 #include <bcm63xx_nvram.h> 24 24 #include <bcm63xx_dev_pci.h> 25 25 #include <bcm63xx_dev_enet.h> 26 - #include <bcm63xx_dev_dsp.h> 27 26 #include <bcm63xx_dev_flash.h> 28 27 #include <bcm63xx_dev_hsspi.h> 29 28 #include <bcm63xx_dev_pcmcia.h> ··· 288 289 .has_pccard = 1, 289 290 .has_ehci0 = 1, 290 291 291 - .has_dsp = 1, 292 - .dsp = { 293 - .gpio_rst = 6, 294 - .gpio_int = 34, 295 - .cs = 2, 296 - .ext_irq = 2, 297 - }, 298 - 299 292 .leds = { 300 293 { 301 294 .name = "adsl-fail", ··· 391 400 }, 392 401 393 402 .has_ohci0 = 1, 394 - 395 - .has_dsp = 1, 396 - .dsp = { 397 - .gpio_rst = 6, 398 - .gpio_int = 34, 399 - .ext_irq = 2, 400 - .cs = 2, 401 - }, 402 403 403 404 .leds = { 404 405 { ··· 880 897 881 898 if (board.has_usbd) 882 899 bcm63xx_usbd_register(&board.usbd); 883 - 884 - if (board.has_dsp) 885 - bcm63xx_dsp_register(&board.dsp); 886 900 887 901 /* Generate MAC address for WLAN and register our SPROM, 888 902 * do this after registering enet devices
-56
arch/mips/bcm63xx/dev-dsp.c
··· 1 - /* 2 - * Broadcom BCM63xx VoIP DSP registration 3 - * 4 - * This file is subject to the terms and conditions of the GNU General Public 5 - * License. See the file "COPYING" in the main directory of this archive 6 - * for more details. 7 - * 8 - * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org> 9 - */ 10 - 11 - #include <linux/init.h> 12 - #include <linux/kernel.h> 13 - #include <linux/platform_device.h> 14 - 15 - #include <bcm63xx_cpu.h> 16 - #include <bcm63xx_dev_dsp.h> 17 - #include <bcm63xx_regs.h> 18 - #include <bcm63xx_io.h> 19 - 20 - static struct resource voip_dsp_resources[] = { 21 - { 22 - .start = -1, /* filled at runtime */ 23 - .end = -1, /* filled at runtime */ 24 - .flags = IORESOURCE_MEM, 25 - }, 26 - { 27 - .start = -1, /* filled at runtime */ 28 - .flags = IORESOURCE_IRQ, 29 - }, 30 - }; 31 - 32 - static struct platform_device bcm63xx_voip_dsp_device = { 33 - .name = "bcm63xx-voip-dsp", 34 - .id = -1, 35 - .num_resources = ARRAY_SIZE(voip_dsp_resources), 36 - .resource = voip_dsp_resources, 37 - }; 38 - 39 - int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd) 40 - { 41 - struct bcm63xx_dsp_platform_data *dpd; 42 - u32 val; 43 - 44 - /* Get the memory window */ 45 - val = bcm_mpi_readl(MPI_CSBASE_REG(pd->cs - 1)); 46 - val &= MPI_CSBASE_BASE_MASK; 47 - voip_dsp_resources[0].start = val; 48 - voip_dsp_resources[0].end = val + 0xFFFFFFF; 49 - voip_dsp_resources[1].start = pd->ext_irq; 50 - 51 - /* copy given platform data */ 52 - dpd = bcm63xx_voip_dsp_device.dev.platform_data; 53 - memcpy(dpd, pd, sizeof (*pd)); 54 - 55 - return platform_device_register(&bcm63xx_voip_dsp_device); 56 - }
-14
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_dsp.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __BCM63XX_DSP_H 3 - #define __BCM63XX_DSP_H 4 - 5 - struct bcm63xx_dsp_platform_data { 6 - unsigned gpio_rst; 7 - unsigned gpio_int; 8 - unsigned cs; 9 - unsigned ext_irq; 10 - }; 11 - 12 - int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd); 13 - 14 - #endif /* __BCM63XX_DSP_H */
-5
arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
··· 7 7 #include <linux/leds.h> 8 8 #include <bcm63xx_dev_enet.h> 9 9 #include <bcm63xx_dev_usb_usbd.h> 10 - #include <bcm63xx_dev_dsp.h> 11 10 12 11 /* 13 12 * flash mapping ··· 30 31 unsigned int has_ohci0:1; 31 32 unsigned int has_ehci0:1; 32 33 unsigned int has_usbd:1; 33 - unsigned int has_dsp:1; 34 34 unsigned int has_uart0:1; 35 35 unsigned int has_uart1:1; 36 36 ··· 40 42 41 43 /* USB config */ 42 44 struct bcm63xx_usbd_platform_data usbd; 43 - 44 - /* DSP config */ 45 - struct bcm63xx_dsp_platform_data dsp; 46 45 47 46 /* GPIO LEDs */ 48 47 struct gpio_led leds[5];