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) {
        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)