Skip to content

Commit 7962fd9

Browse files
committed
Merge tag 'riscv-soc-fixes-for-v7.0-rc6' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/conor/linux into arm/fixes
RISC-V soc fixes for v7.0-rc6 Microchip: More resource leak fixes for unlikely scenarios, and a change to the auto-update "firmware" driver to prevent it probing on systems with engineering silicon where it cannot be used. Signed-off-by: Conor Dooley <conor.dooley@microchip.com> * tag 'riscv-soc-fixes-for-v7.0-rc6' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/conor/linux: firmware: microchip: fail auto-update probe if no flash found soc: microchip: mpfs-mss-top-sysreg: Fix resource leak on driver unbind soc: microchip: mpfs-control-scb: Fix resource leak on driver unbind Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
2 parents 4b2b3f0 + c7596f9 commit 7962fd9

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

drivers/firmware/microchip/mpfs-auto-update.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ static enum fw_upload_err mpfs_auto_update_prepare(struct fw_upload *fw_uploader
113113
* be added here.
114114
*/
115115

116-
priv->flash = mpfs_sys_controller_get_flash(priv->sys_controller);
117-
if (!priv->flash)
118-
return FW_UPLOAD_ERR_HW_ERROR;
119-
120116
erase_size = round_up(erase_size, (u64)priv->flash->erasesize);
121117

122118
/*
@@ -427,6 +423,12 @@ static int mpfs_auto_update_probe(struct platform_device *pdev)
427423
return dev_err_probe(dev, PTR_ERR(priv->sys_controller),
428424
"Could not register as a sub device of the system controller\n");
429425

426+
priv->flash = mpfs_sys_controller_get_flash(priv->sys_controller);
427+
if (IS_ERR_OR_NULL(priv->flash)) {
428+
dev_dbg(dev, "No flash connected to the system controller, auto-update not supported\n");
429+
return -ENODEV;
430+
}
431+
430432
priv->dev = dev;
431433
platform_set_drvdata(pdev, priv);
432434

drivers/soc/microchip/mpfs-control-scb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ static int mpfs_control_scb_probe(struct platform_device *pdev)
1414
{
1515
struct device *dev = &pdev->dev;
1616

17-
return mfd_add_devices(dev, PLATFORM_DEVID_NONE, mpfs_control_scb_devs,
18-
ARRAY_SIZE(mpfs_control_scb_devs), NULL, 0, NULL);
17+
return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
18+
mpfs_control_scb_devs,
19+
ARRAY_SIZE(mpfs_control_scb_devs), NULL, 0,
20+
NULL);
1921
}
2022

2123
static const struct of_device_id mpfs_control_scb_of_match[] = {

drivers/soc/microchip/mpfs-mss-top-sysreg.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ static int mpfs_mss_top_sysreg_probe(struct platform_device *pdev)
1616
struct device *dev = &pdev->dev;
1717
int ret;
1818

19-
ret = mfd_add_devices(dev, PLATFORM_DEVID_NONE, mpfs_mss_top_sysreg_devs,
20-
ARRAY_SIZE(mpfs_mss_top_sysreg_devs) , NULL, 0, NULL);
19+
ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
20+
mpfs_mss_top_sysreg_devs,
21+
ARRAY_SIZE(mpfs_mss_top_sysreg_devs), NULL,
22+
0, NULL);
2123
if (ret)
2224
return ret;
2325

0 commit comments

Comments
 (0)