Skip to content

[PW_SID:1081700] soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration#1776

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

[PW_SID:1081700] soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration#1776
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1081700

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1081700 applied to workflow__riscv__fixes

Name: soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1081700
Version: 1

…ice registration

When platform_device_register() fails in mpfs_sys_controller_probe(),
the embedded struct device in subdevs[i] has already been initialized by
device_initialize(), but the failure path only reports the error and
does not drop the device reference for the current platform device:

  mpfs_sys_controller_probe()
    -> platform_device_register(&subdevs[i])
       -> device_initialize(&subdevs[i].dev)
       -> setup_pdev_dma_masks(&subdevs[i])
       -> platform_device_add(&subdevs[i])

This leads to a reference leak when platform_device_register() fails.
Fix this by calling platform_device_put() after reporting the error.

The issue was identified by a static analysis tool I developed and
confirmed by manual review.

Fixes: d0054a4 ("soc: add microchip polarfire soc system controller")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 135.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1022.40 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1378.09 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 24.65 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 26.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.82 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 84.15 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
kdoc
Desc: Detects for kdoc errors
Duration: 0.82 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "soc: microchip: mpfs-sys-controller: fix reference leak on failed device registration"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot deleted the pw1081700 branch April 23, 2026 01:56
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