Bug 216748 - Kconfig has some dangling references
Summary: Kconfig has some dangling references
Status: NEW
Alias: None
Product: Other
Classification: Unclassified
Component: Configuration (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: other_configuration@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-28 18:18 UTC by Andrew Jones
Modified: 2023-01-22 19:36 UTC (History)
1 user (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments
perl script to hunt for dangling references in Kconfig (1.16 KB, application/x-perl)
2022-11-28 18:18 UTC, Andrew Jones
Details
grep results for each symbol output from the attached perl script (4.85 KB, text/plain)
2022-11-28 18:21 UTC, Andrew Jones
Details

Description Andrew Jones 2022-11-28 18:18:02 UTC
Created attachment 303311 [details]
perl script to hunt for dangling references in Kconfig

A recent patch for arch/riscv/Kconfig pointed out that the wrong name for a symbol was being referenced in 'range' attributes. This implied that other "dangling references" may exist. I'm not aware of a kconfig check which can be run for this detection so I hacked an ugly perl script to attempt to do it. Here are the results of running it

ARCH_BCM4908
ARCH_HAS_HOLES_MEMORYMODEL
ARCH_THUNDERBAY
ARCH_VERSAL
ARM_ERRATA_794072
CC_CAN_LINK_STATIC_NO_RUNTIME_DEPS
CLK_FIXED_FCH
CONFIG_STM
DEBUG_OMAP3UART1
DEBUG_OMAP3UART2
DRM_DEBUG_SELFTEST
DRM_DP_HELPER
DRM_KMS_DMA_HELPER
HAVE_LEGACY_CLK
INTEL_IFS_DEVICE
MACH_DAVINCI_DM6467_EVM
MACH_DAVINCI_EVM
MACH_JZ4760
MFD_MAX597X
MFD_SM5703
MFD_TN48M_CPLD
MFD_TPS65219
MIPS_BAIKAL_T1
MTK_DVFSRC
PINCTRL_MILBEAUT
PL310
SBI_V01
SND_SOC_AC97_BUS_NEW
USB_HSIC_USB3613


SBI_V01 was the one pointed out in the recent riscv patch. And checking with grep

$ git grep -n -w -e SBI_V01 -e CONFIG_SBI_V01
arch/riscv/Kconfig:320: range 2 512 if !SBI_V01
arch/riscv/Kconfig:321: range 2 32 if SBI_V01 && 32BIT
arch/riscv/Kconfig:322: range 2 64 if SBI_V01 && 64BIT

shows the symbol is indeed non-exist and never used. Running the same grep on all the symbols produced output that appears to validate the perl script (which is attached).

I'm not exactly sure how to alert all the different drivers and subsystems about potential issues with their respective symbols. Below is a list of affected files and I'll attach the grep output for each symbol like the SBI_V01 example above. Hopefully the filenames will trigger some filters. (I've removed the riscv output since it's already known and fixed.)

arch/arm/Kconfig.debug
arch/arm/mach-milbeaut/Kconfig
arch/arm/mach-npcm/Kconfig
arch/arm/mach-omap1/Kconfig
arch/arm/mach-socfpga/Kconfig
arch/arm/tools/mach-types
arch/m68k/Kconfig.cpu
arch/mips/Kconfig
arch/sh/boards/Kconfig
arch/um/Kconfig
drivers/ata/Kconfig
drivers/bus/Kconfig
drivers/clk/baikal-t1/Kconfig
drivers/clk/ingenic/Kconfig
drivers/clk/Kconfig
drivers/gpio/Kconfig
drivers/gpu/drm/bridge/Kconfig
drivers/gpu/drm/i915/Kconfig.debug
drivers/gpu/drm/logicvc/Kconfig
drivers/hwmon/Kconfig
drivers/hwtracing/stm/Kconfig
drivers/hwtracing/stm/Makefile
drivers/i2c/busses/Kconfig
drivers/leds/blink/Kconfig
drivers/Makefile
drivers/memory/Kconfig
drivers/mtd/maps/Kconfig
drivers/mtd/parsers/Kconfig
drivers/phy/intel/Kconfig
drivers/pinctrl/Kconfig
drivers/pinctrl/pinctrl-ingenic.c
drivers/platform/x86/intel/ifs/Kconfig
drivers/regulator/Kconfig
drivers/reset/Kconfig
drivers/spi/Kconfig
drivers/staging/greybus/arche-platform.c
drivers/staging/greybus/Kconfig
drivers/usb/dwc3/Kconfig
sound/soc/amd/acp/Kconfig
sound/soc/amd/Kconfig
sound/soc/pxa/Kconfig
sound/soc/ti/Kconfig
Comment 1 Andrew Jones 2022-11-28 18:21:11 UTC
Created attachment 303312 [details]
grep results for each symbol output from the attached perl script

for s in $(./bad-syms.pl); do echo $s ---; git grep -n -w -e $s -e CONFIG_$s; echo; done

PL310 had a bunch of irrelevant lines in the grep output that I manually removed.
Comment 2 Andy Shevchenko 2023-01-22 19:36:37 UTC
I believe the best is to drop a message into Linux Kernel Mailing List for that. And actually discuss there that somebody will take care of bugzilla.kernel.org for risc-V issues.

Note You need to log in before you can comment on or make changes to this bug.