Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+14 -11
+10 -9
drivers/memory/mtk-smi.c
··· 319 319 struct device *dev = &pdev->dev; 320 320 struct device_node *smi_node; 321 321 struct platform_device *smi_pdev; 322 + struct device_link *link; 322 323 323 324 larb = devm_kzalloc(dev, sizeof(*larb), GFP_KERNEL); 324 325 if (!larb) ··· 359 358 if (!platform_get_drvdata(smi_pdev)) 360 359 return -EPROBE_DEFER; 361 360 larb->smi_common_dev = &smi_pdev->dev; 361 + link = device_link_add(dev, larb->smi_common_dev, 362 + DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS); 363 + if (!link) { 364 + dev_err(dev, "Unable to link smi-common dev\n"); 365 + return -ENODEV; 366 + } 362 367 } else { 363 368 dev_err(dev, "Failed to get the smi_common device\n"); 364 369 return -EINVAL; ··· 377 370 378 371 static int mtk_smi_larb_remove(struct platform_device *pdev) 379 372 { 373 + struct mtk_smi_larb *larb = platform_get_drvdata(pdev); 374 + 375 + device_link_remove(&pdev->dev, larb->smi_common_dev); 380 376 pm_runtime_disable(&pdev->dev); 381 377 component_del(&pdev->dev, &mtk_smi_larb_component_ops); 382 378 return 0; ··· 391 381 const struct mtk_smi_larb_gen *larb_gen = larb->larb_gen; 392 382 int ret; 393 383 394 - /* Power on smi-common. */ 395 - ret = pm_runtime_resume_and_get(larb->smi_common_dev); 396 - if (ret < 0) { 397 - dev_err(dev, "Failed to pm get for smi-common(%d).\n", ret); 398 - return ret; 399 - } 400 - 401 384 ret = mtk_smi_clk_enable(&larb->smi); 402 385 if (ret < 0) { 403 386 dev_err(dev, "Failed to enable clock(%d).\n", ret); 404 - pm_runtime_put_sync(larb->smi_common_dev); 405 387 return ret; 406 388 } 407 389 ··· 408 406 struct mtk_smi_larb *larb = dev_get_drvdata(dev); 409 407 410 408 mtk_smi_clk_disable(&larb->smi); 411 - pm_runtime_put_sync(larb->smi_common_dev); 412 409 return 0; 413 410 } 414 411
+1 -1
drivers/memory/renesas-rpc-if.c
··· 192 192 } 193 193 194 194 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap"); 195 - rpc->size = resource_size(res); 196 195 rpc->dirmap = devm_ioremap_resource(&pdev->dev, res); 197 196 if (IS_ERR(rpc->dirmap)) 198 197 rpc->dirmap = NULL; 198 + rpc->size = resource_size(res); 199 199 200 200 rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); 201 201
+3 -1
drivers/memory/samsung/exynos5422-dmc.c
··· 1298 1298 1299 1299 dmc->curr_volt = target_volt; 1300 1300 1301 - clk_set_parent(dmc->mout_mx_mspll_ccore, dmc->mout_spll); 1301 + ret = clk_set_parent(dmc->mout_mx_mspll_ccore, dmc->mout_spll); 1302 + if (ret) 1303 + return ret; 1302 1304 1303 1305 clk_prepare_enable(dmc->fout_bpll); 1304 1306 clk_prepare_enable(dmc->mout_bpll);