Skip to content

Commit 36ca529

Browse files
MrVanShawn Guo
authored andcommitted
soc: imx: Use dev_err_probe() for i.MX9
Use dev_err_probe() to simplify code. No functional changes. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
1 parent ab382a6 commit 36ca529

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

drivers/soc/imx/soc-imx9.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ static int imx9_soc_probe(struct platform_device *pdev)
3131
return -ENOMEM;
3232

3333
err = of_property_read_string(of_root, "model", &attr->machine);
34-
if (err) {
35-
pr_err("%s: missing model property: %d\n", __func__, err);
36-
return err;
37-
}
34+
if (err)
35+
return dev_err_probe(dev, err, "%s: missing model property\n", __func__);
3836

3937
attr->family = devm_kasprintf(dev, GFP_KERNEL, "Freescale i.MX");
4038

@@ -46,10 +44,8 @@ static int imx9_soc_probe(struct platform_device *pdev)
4644
* res.a3: uid[63:0];
4745
*/
4846
arm_smccc_smc(IMX_SIP_GET_SOC_INFO, 0, 0, 0, 0, 0, 0, 0, &res);
49-
if (res.a0 != SMCCC_RET_SUCCESS) {
50-
pr_err("%s: SMC failed: 0x%lx\n", __func__, res.a0);
51-
return -EINVAL;
52-
}
47+
if (res.a0 != SMCCC_RET_SUCCESS)
48+
return dev_err_probe(dev, -EINVAL, "%s: SMC failed: 0x%lx\n", __func__, res.a0);
5349

5450
soc_id = SOC_ID(res.a1);
5551
rev_major = SOC_REV_MAJOR(res.a1);
@@ -63,11 +59,9 @@ static int imx9_soc_probe(struct platform_device *pdev)
6359
attr->serial_number = devm_kasprintf(dev, GFP_KERNEL, "%016llx%016llx", uid127_64, uid63_0);
6460

6561
sdev = soc_device_register(attr);
66-
if (IS_ERR(sdev)) {
67-
err = PTR_ERR(sdev);
68-
pr_err("%s failed to register SoC as a device: %d\n", __func__, err);
69-
return err;
70-
}
62+
if (IS_ERR(sdev))
63+
return dev_err_probe(dev, PTR_ERR(sdev),
64+
"%s failed to register SoC as a device\n", __func__);
7165

7266
return 0;
7367
}

0 commit comments

Comments
 (0)