diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-11-02 19:27:33 +0100 |
---|---|---|
committer | Andy Gross <andy.gross@linaro.org> | 2018-01-01 00:29:09 -0600 |
commit | c01fc2275e01a91e2243d9202c04f3ed872f9de8 (patch) | |
tree | b8f8b0ede6c7c27084d739cf59699a3f927a205e /drivers/soc | |
parent | 3830d0771ef66a3bb9ab57b70630b3598593a4f0 (diff) |
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 <elfring@users.sourceforge.net>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r-- | drivers/soc/qcom/smp2p.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c index 669c8baa971b..c22503cd1edf 100644 --- a/drivers/soc/qcom/smp2p.c +++ b/drivers/soc/qcom/smp2p.c @@ -473,17 +473,13 @@ static int qcom_smp2p_probe(struct platform_device *pdev) key = "qcom,local-pid"; ret = of_property_read_u32(pdev->dev.of_node, key, &smp2p->local_pid); - if (ret < 0) { - dev_err(&pdev->dev, "failed to read %s\n", key); - return -EINVAL; - } + if (ret) + goto report_read_failure; key = "qcom,remote-pid"; ret = of_property_read_u32(pdev->dev.of_node, key, &smp2p->remote_pid); - if (ret < 0) { - dev_err(&pdev->dev, "failed to read %s\n", key); - return -EINVAL; - } + if (ret) + goto report_read_failure; irq = platform_get_irq(pdev, 0); if (irq < 0) { @@ -566,6 +562,10 @@ release_mbox: mbox_free_channel(smp2p->mbox_chan); return ret; + +report_read_failure: + dev_err(&pdev->dev, "failed to read %s\n", key); + return -EINVAL; } static int qcom_smp2p_remove(struct platform_device *pdev) |