Memory controller drivers for v5.13, part two

1. Renesas RPC: fix possible NULL pointer.
 2. Exynos5422 DMC: add proper error checking for clk_prepare.
 3. Mediatek SMI: use device-links instead of explicit PM runtime calls.
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAmB34vIQHGtyemtAa2Vy
 bmVsLm9yZwAKCRDBN2bmhouD180kD/9YhYZxnUoOb7cFzJNrtc/Pnbo/ggcENfpx
 nddzzhK1MKZ5rhXrXCkILrOBo4twhDD/nmebav+ogVukreV9PinUlu1iPbOlZdyC
 LAqbbIBuYVa3T0NxpCISx7+CURvQeD08osuEvlRfm7vZS1S9XHIa5B8GcNbGqnCy
 CpDbvjImLkRKZ/3U0AYWnmOkP3BuppNUdvH2wt4D73A+B+rcAjeaoAQsnmREukuT
 Bch8xwyZuiFO4UMS91Ndd97ERuEBQFjs2/Ff6awKse7QcLuJVaBCqJ1y10pnavoG
 NMAsb7ThojGZE6xcIioZJ9lsO5rF2oYSSTW9xmg/n//uAVhT0ZZqmx4u0SVRsKJ+
 ShQ/5+uLgrG2A8ujrNO31yYFwipVLOfgFGsS5D3k9YEuiHEQ1taNUkq2TWjU+DIR
 0LrJ4W6eWbbTqS9OT/V45NMy/rBudGsLN9orTEPDBMMkCyotHZ7LTTMcFO+BkKvC
 +eatA1ILJoCarm/yRv7+aRpOo9HQZ2zZbvSOpeHc5rgOOWbyBOx0uRWUWahNhDll
 uMGsAfYMuAYUFiSHK1P3bc6VUzQua570HpEPpe2n5TD1O0gwRLXjYoyIwgLnZ9ar
 xhUBfeNN8YIEW3hhnaD33mAMGqjFfMcJx1bINelgjtZ5zG22H79XfNkpdhm9JCEQ
 FbJTKUDvhQ==
 =OtAm
 -----END PGP SIGNATURE-----

Merge tag 'memory-controller-drv-5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl into arm/drivers

Memory controller drivers for v5.13, part two

1. Renesas RPC: fix possible NULL pointer.
2. Exynos5422 DMC: add proper error checking for clk_prepare.
3. Mediatek SMI: use device-links instead of explicit PM runtime calls.

* tag 'memory-controller-drv-5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl:
  memory: mtk-smi: Add device-link between smi-larb and smi-common
  memory: samsung: exynos5422-dmc: handle clk_set_parent() failure
  memory: renesas-rpc-if: fix possible NULL pointer dereference of resource

Link: https://lore.kernel.org/r/20210415065514.7385-1-krzysztof.kozlowski@canonical.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2021-04-19 16:32:34 +02:00
commit 8c0bd213de
3 changed files with 14 additions and 11 deletions

View File

@ -319,6 +319,7 @@ static int mtk_smi_larb_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct device_node *smi_node;
struct platform_device *smi_pdev;
struct device_link *link;
larb = devm_kzalloc(dev, sizeof(*larb), GFP_KERNEL);
if (!larb)
@ -358,6 +359,12 @@ static int mtk_smi_larb_probe(struct platform_device *pdev)
if (!platform_get_drvdata(smi_pdev))
return -EPROBE_DEFER;
larb->smi_common_dev = &smi_pdev->dev;
link = device_link_add(dev, larb->smi_common_dev,
DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
if (!link) {
dev_err(dev, "Unable to link smi-common dev\n");
return -ENODEV;
}
} else {
dev_err(dev, "Failed to get the smi_common device\n");
return -EINVAL;
@ -370,6 +377,9 @@ static int mtk_smi_larb_probe(struct platform_device *pdev)
static int mtk_smi_larb_remove(struct platform_device *pdev)
{
struct mtk_smi_larb *larb = platform_get_drvdata(pdev);
device_link_remove(&pdev->dev, larb->smi_common_dev);
pm_runtime_disable(&pdev->dev);
component_del(&pdev->dev, &mtk_smi_larb_component_ops);
return 0;
@ -381,17 +391,9 @@ static int __maybe_unused mtk_smi_larb_resume(struct device *dev)
const struct mtk_smi_larb_gen *larb_gen = larb->larb_gen;
int ret;
/* Power on smi-common. */
ret = pm_runtime_resume_and_get(larb->smi_common_dev);
if (ret < 0) {
dev_err(dev, "Failed to pm get for smi-common(%d).\n", ret);
return ret;
}
ret = mtk_smi_clk_enable(&larb->smi);
if (ret < 0) {
dev_err(dev, "Failed to enable clock(%d).\n", ret);
pm_runtime_put_sync(larb->smi_common_dev);
return ret;
}
@ -406,7 +408,6 @@ static int __maybe_unused mtk_smi_larb_suspend(struct device *dev)
struct mtk_smi_larb *larb = dev_get_drvdata(dev);
mtk_smi_clk_disable(&larb->smi);
pm_runtime_put_sync(larb->smi_common_dev);
return 0;
}

View File

@ -192,10 +192,10 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap");
rpc->size = resource_size(res);
rpc->dirmap = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rpc->dirmap))
rpc->dirmap = NULL;
rpc->size = resource_size(res);
rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);

View File

@ -1298,7 +1298,9 @@ static int exynos5_dmc_init_clks(struct exynos5_dmc *dmc)
dmc->curr_volt = target_volt;
clk_set_parent(dmc->mout_mx_mspll_ccore, dmc->mout_spll);
ret = clk_set_parent(dmc->mout_mx_mspll_ccore, dmc->mout_spll);
if (ret)
return ret;
clk_prepare_enable(dmc->fout_bpll);
clk_prepare_enable(dmc->mout_bpll);