Skip to content

Commit b69d481

Browse files
committed
Merge tag 'riscv-soc-fixes-for-v7.0-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux into arm/fixes
RISC-V soc fixes for v7.0-rc1 drivers: Fix leaks in probe/init function teardown code in three drivers. microchip: Fix a warning introduced by a recent binding change, that made resets required on Polarfire SoC's CAN IP. Signed-off-by: Conor Dooley <conor.dooley@microchip.com> * tag 'riscv-soc-fixes-for-v7.0-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux: cache: ax45mp: Fix device node reference leak in ax45mp_cache_init() cache: starfive: fix device node leak in starlink_cache_init() riscv: dts: microchip: add can resets to mpfs soc: microchip: mpfs: Fix memory leak in mpfs_sys_controller_probe() Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 11439c4 + 0528a34 commit b69d481

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

arch/riscv/boot/dts/microchip/mpfs.dtsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@
428428
clocks = <&clkcfg CLK_CAN0>, <&clkcfg CLK_MSSPLL3>;
429429
interrupt-parent = <&plic>;
430430
interrupts = <56>;
431+
resets = <&mss_top_sysreg CLK_CAN0>;
431432
status = "disabled";
432433
};
433434

@@ -437,6 +438,7 @@
437438
clocks = <&clkcfg CLK_CAN1>, <&clkcfg CLK_MSSPLL3>;
438439
interrupt-parent = <&plic>;
439440
interrupts = <57>;
441+
resets = <&mss_top_sysreg CLK_CAN1>;
440442
status = "disabled";
441443
};
442444

drivers/cache/ax45mp_cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ static const struct of_device_id ax45mp_cache_ids[] = {
178178

179179
static int __init ax45mp_cache_init(void)
180180
{
181-
struct device_node *np;
182181
struct resource res;
183182
int ret;
184183

185-
np = of_find_matching_node(NULL, ax45mp_cache_ids);
184+
struct device_node *np __free(device_node) =
185+
of_find_matching_node(NULL, ax45mp_cache_ids);
186186
if (!of_device_is_available(np))
187187
return -ENODEV;
188188

drivers/cache/starfive_starlink_cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ static const struct of_device_id starlink_cache_ids[] = {
102102

103103
static int __init starlink_cache_init(void)
104104
{
105-
struct device_node *np;
106105
u32 block_size;
107106
int ret;
108107

109-
np = of_find_matching_node(NULL, starlink_cache_ids);
108+
struct device_node *np __free(device_node) =
109+
of_find_matching_node(NULL, starlink_cache_ids);
110110
if (!of_device_is_available(np))
111111
return -ENODEV;
112112

drivers/soc/microchip/mpfs-sys-controller.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ static int mpfs_sys_controller_probe(struct platform_device *pdev)
142142

143143
sys_controller->flash = of_get_mtd_device_by_node(np);
144144
of_node_put(np);
145-
if (IS_ERR(sys_controller->flash))
146-
return dev_err_probe(dev, PTR_ERR(sys_controller->flash), "Failed to get flash\n");
145+
if (IS_ERR(sys_controller->flash)) {
146+
ret = dev_err_probe(dev, PTR_ERR(sys_controller->flash), "Failed to get flash\n");
147+
goto out_free;
148+
}
147149

148150
no_flash:
149151
sys_controller->client.dev = dev;
@@ -155,8 +157,7 @@ static int mpfs_sys_controller_probe(struct platform_device *pdev)
155157
if (IS_ERR(sys_controller->chan)) {
156158
ret = dev_err_probe(dev, PTR_ERR(sys_controller->chan),
157159
"Failed to get mbox channel\n");
158-
kfree(sys_controller);
159-
return ret;
160+
goto out_free;
160161
}
161162

162163
init_completion(&sys_controller->c);
@@ -174,6 +175,10 @@ static int mpfs_sys_controller_probe(struct platform_device *pdev)
174175
dev_info(&pdev->dev, "Registered MPFS system controller\n");
175176

176177
return 0;
178+
179+
out_free:
180+
kfree(sys_controller);
181+
return ret;
177182
}
178183

179184
static void mpfs_sys_controller_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)