Skip to content

[PW_SID:1097520] pinctrl: spacemit: fix NULL check in spacemit_pin_set_config#1976

Closed
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1097520
Closed

[PW_SID:1097520] pinctrl: spacemit: fix NULL check in spacemit_pin_set_config#1976
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1097520

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1097520 applied to workflow__riscv__fixes

Name: pinctrl: spacemit: fix NULL check in spacemit_pin_set_config
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1097520
Version: 1

spacemit_pin_set_config() looks up the per-pin descriptor with
spacemit_get_pin() then checks the wrong variable for failure:

	const struct spacemit_pin *spin = spacemit_get_pin(pctrl, pin);
	...
	if (!pin)
		return -EINVAL;

	reg = spacemit_pin_to_reg(pctrl, spin->pin);

pin is an unsigned int pin id, where 0 (GPIO_0 / gmac0_rxdv on K3) is a
valid pin, so rejecting it here drops the PAD config write for the first
pin of every group. On K3 Pico-ITX the GMAC RGMII group lists pin 0 as
its first entry, so its drive-strength / bias configuration was silently
ignored.

The intended guard is against spacemit_get_pin() returning NULL when the
pin id isn't in the SoC's pin table. Check spin instead, which both
restores PAD setup for pin 0 and prevents a NULL deref on spin->pin.

Fixes: a83c29e ("pinctrl: spacemit: add support for SpacemiT K1 SoC")
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 114.01 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1120.18 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1637.79 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.03 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.81 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.61 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 76.79 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
kdoc
Desc: Detects for kdoc errors
Duration: 0.71 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "pinctrl: spacemit: fix NULL check in spacemit_pin_set_config"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot deleted the pw1097520 branch May 19, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants