Files
linux/drivers/mfd
Guangshuo Li 8c2f0b42fc mfd: sm501: Fix reference leak on failed device registration
When platform_device_register() fails in sm501_register_device(), the
embedded struct device in pdev has already been initialized by
device_initialize(), but the failure path only reports the error and
returns without dropping the device reference for the current platform
device:

  sm501_register_device()
    -> platform_device_register(pdev)
       -> device_initialize(&pdev->dev)
       -> setup_pdev_dma_masks(pdev)
       -> platform_device_add(pdev)

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

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

Fixes: b6d6454fdb ("[PATCH] mfd: SM501 core driver")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Link: https://patch.msgid.link/20260415162627.3558789-1-lgs201920130244@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-06-17 11:30:45 +01:00
..
2025-10-01 10:29:00 +01:00
2026-06-17 11:30:35 +01:00
2025-09-16 15:24:48 +01:00
2026-01-20 14:57:41 +00:00
2026-01-20 14:57:41 +00:00
2024-05-10 15:39:18 +01:00
2024-05-10 15:39:18 +01:00
2023-04-26 11:40:34 +01:00
2026-06-17 11:26:50 +01:00
2025-05-16 21:06:10 +02:00