MLK-17237 staging: typec: return error when tcpci_parse_config has failed
authorPeter Chen <peter.chen@nxp.com>
Mon, 18 Dec 2017 09:21:43 +0000 (17:21 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:51:56 +0000 (14:51 -0500)
Otherwise, the probe would be considered successfully, and without
do any destroy jobs, eg, the interrupt has still registered.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
drivers/staging/typec/tcpci.c

index e2913ea..8d38d75 100644 (file)
@@ -632,7 +632,7 @@ const struct tcpc_config tcpci_tcpc_config = {
 static int tcpci_parse_config(struct tcpci *tcpci)
 {
        struct tcpc_config *tcfg;
-       int ret = 0;
+       int ret = -EINVAL;
 
        tcpci->controls_vbus = true; /* XXX */
 
@@ -745,8 +745,10 @@ static int tcpci_parse_config(struct tcpci *tcpci)
                device_property_read_u32(tcpci->dev, "max-snk-mw",
                                                &tcfg->max_snk_mw) ||
                device_property_read_u32(tcpci->dev, "op-snk-mw",
-                                               &tcfg->operating_snk_mw))
+                                               &tcfg->operating_snk_mw)) {
+               ret = -EINVAL;
                goto snk_setting_wrong;
+       }
 
        return 0;