EDAC/xgene: use devm_platform_ioremap_resource in probe
Subsystems (2)
PATCH 1/1 EDAC/xgene: use devm_platform_ioremap_resource in probe
Replace the open-coded platform_get_resource() + devm_ioremap_resource() pair in xgene_edac_probe() with the single helper devm_platform_ioremap_resource(), fetching the PCP CSR mapping up front and assigning it to edac->pcp_csr after the edac context is allocated. The redundant struct resource and the late re-ioremap are dropped.
Built for arm64 (CONFIG_EDAC_XGENE) with LLVM=1; drivers/edac/xgene_edac.o compiles cleanly and passes checkpatch --strict.
Assisted-by opencode:hy3-free
Signed-off-by Rosen Penev <[email protected]>
--- drivers/edac/xgene_edac.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/edac/xgene_edac.c +6 -8
@@ -1844,9 +1844,13 @@ static int xgene_edac_probe(struct platform_device *pdev) {struct xgene_edac *edac;struct device_node *child; -struct resource *res; +void __iomem *pcp_csr;int rc; + pcp_csr =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (pcp_csr)) +return PTR_ERR (pcp_csr); + edac =devm_kzalloc (&pdev->dev,sizeof (*edac),GFP_KERNEL );if (!edac)return -ENOMEM ;
@@ -1902,13 +1906,7 @@ static int xgene_edac_probe(struct platform_device *pdev) edac->rb_map =NULL ; } - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - edac->pcp_csr =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (edac->pcp_csr)) { -dev_err (&pdev->dev,"no PCP resource address\n" ); - rc =PTR_ERR (edac->pcp_csr); - goto out_err; - } + edac->pcp_csr = pcp_csr;if (edac_op_state ==EDAC_OPSTATE_INT ) {int irq;
Signature · 1 line
2.55.0