Skip to content

Commit c01fc22

Browse files
elfringAndy Gross
authored and
Andy Gross
committed
soc: qcom: smp2p: Use common error handling code in qcom_smp2p_probe()
* Add a jump target so that a specific error message is stored only once at the end of this function implementation. * Replace two calls of the function "dev_err" by goto statements. * Adjust two condition checks. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <[email protected]> Signed-off-by: Andy Gross <[email protected]>
1 parent 3830d07 commit c01fc22

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/soc/qcom/smp2p.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -473,17 +473,13 @@ static int qcom_smp2p_probe(struct platform_device *pdev)
473473

474474
key = "qcom,local-pid";
475475
ret = of_property_read_u32(pdev->dev.of_node, key, &smp2p->local_pid);
476-
if (ret < 0) {
477-
dev_err(&pdev->dev, "failed to read %s\n", key);
478-
return -EINVAL;
479-
}
476+
if (ret)
477+
goto report_read_failure;
480478

481479
key = "qcom,remote-pid";
482480
ret = of_property_read_u32(pdev->dev.of_node, key, &smp2p->remote_pid);
483-
if (ret < 0) {
484-
dev_err(&pdev->dev, "failed to read %s\n", key);
485-
return -EINVAL;
486-
}
481+
if (ret)
482+
goto report_read_failure;
487483

488484
irq = platform_get_irq(pdev, 0);
489485
if (irq < 0) {
@@ -566,6 +562,10 @@ static int qcom_smp2p_probe(struct platform_device *pdev)
566562
mbox_free_channel(smp2p->mbox_chan);
567563

568564
return ret;
565+
566+
report_read_failure:
567+
dev_err(&pdev->dev, "failed to read %s\n", key);
568+
return -EINVAL;
569569
}
570570

571571
static int qcom_smp2p_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)