Skip to content

Commit 44e4a2c

Browse files
committed
Merge tag 'memory-controller-drv-fixes-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl into arm/fixes
Memory controller drivers - fixes for v5.18 Issues in v5.18: 1. Freescale/NXP: fix populating children of Integrated Flash Controller DT nodes. Issues existing before: 1. Renesas: fix platform-device leak in probe's error path. 2. Atmel: fix of_node reference leak in probe's error path. 3. Synopsys: correct the bindings for snps,ddrc-3.80a (interrupts are required). * tag 'memory-controller-drv-fixes-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl: memory: fsl_ifc: populate child nodes of buses and mfd devices dt-bindings: memory: snps,ddrc-3.80a compatible also need interrupts memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe memory: renesas-rpc-if: fix platform-device leak in error path Link: https://lore.kernel.org/r/20220407081448.113208-1-krzysztof.kozlowski@linaro.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 02481c7 + dd8adc7 commit 44e4a2c

4 files changed

Lines changed: 31 additions & 11 deletions

File tree

Documentation/devicetree/bindings/memory-controllers/synopsys,ddrc-ecc.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ description: |
2424
properties:
2525
compatible:
2626
enum:
27+
- snps,ddrc-3.80a
2728
- xlnx,zynq-ddrc-a05
2829
- xlnx,zynqmp-ddrc-2.40a
29-
- snps,ddrc-3.80a
3030

3131
interrupts:
3232
maxItems: 1
@@ -43,7 +43,9 @@ allOf:
4343
properties:
4444
compatible:
4545
contains:
46-
const: xlnx,zynqmp-ddrc-2.40a
46+
enum:
47+
- snps,ddrc-3.80a
48+
- xlnx,zynqmp-ddrc-2.40a
4749
then:
4850
required:
4951
- interrupts

drivers/memory/atmel-ebi.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -544,20 +544,27 @@ static int atmel_ebi_probe(struct platform_device *pdev)
544544
smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0);
545545

546546
ebi->smc.regmap = syscon_node_to_regmap(smc_np);
547-
if (IS_ERR(ebi->smc.regmap))
548-
return PTR_ERR(ebi->smc.regmap);
547+
if (IS_ERR(ebi->smc.regmap)) {
548+
ret = PTR_ERR(ebi->smc.regmap);
549+
goto put_node;
550+
}
549551

550552
ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
551-
if (IS_ERR(ebi->smc.layout))
552-
return PTR_ERR(ebi->smc.layout);
553+
if (IS_ERR(ebi->smc.layout)) {
554+
ret = PTR_ERR(ebi->smc.layout);
555+
goto put_node;
556+
}
553557

554558
ebi->smc.clk = of_clk_get(smc_np, 0);
555559
if (IS_ERR(ebi->smc.clk)) {
556-
if (PTR_ERR(ebi->smc.clk) != -ENOENT)
557-
return PTR_ERR(ebi->smc.clk);
560+
if (PTR_ERR(ebi->smc.clk) != -ENOENT) {
561+
ret = PTR_ERR(ebi->smc.clk);
562+
goto put_node;
563+
}
558564

559565
ebi->smc.clk = NULL;
560566
}
567+
of_node_put(smc_np);
561568
ret = clk_prepare_enable(ebi->smc.clk);
562569
if (ret)
563570
return ret;
@@ -608,6 +615,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
608615
}
609616

610617
return of_platform_populate(np, NULL, NULL, dev);
618+
619+
put_node:
620+
of_node_put(smc_np);
621+
return ret;
611622
}
612623

613624
static __maybe_unused int atmel_ebi_resume(struct device *dev)

drivers/memory/fsl_ifc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
287287
}
288288

289289
/* legacy dts may still use "simple-bus" compatible */
290-
ret = of_platform_populate(dev->dev.of_node, NULL, NULL,
291-
&dev->dev);
290+
ret = of_platform_default_populate(dev->dev.of_node, NULL, &dev->dev);
292291
if (ret)
293292
goto err_free_nandirq;
294293

drivers/memory/renesas-rpc-if.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ static int rpcif_probe(struct platform_device *pdev)
651651
struct platform_device *vdev;
652652
struct device_node *flash;
653653
const char *name;
654+
int ret;
654655

655656
flash = of_get_next_child(pdev->dev.of_node, NULL);
656657
if (!flash) {
@@ -674,7 +675,14 @@ static int rpcif_probe(struct platform_device *pdev)
674675
return -ENOMEM;
675676
vdev->dev.parent = &pdev->dev;
676677
platform_set_drvdata(pdev, vdev);
677-
return platform_device_add(vdev);
678+
679+
ret = platform_device_add(vdev);
680+
if (ret) {
681+
platform_device_put(vdev);
682+
return ret;
683+
}
684+
685+
return 0;
678686
}
679687

680688
static int rpcif_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)