Browse Source

asoc: codecs: Add checking of WSA SWR dt params

Add to avoid crashing related to device tree parsing
of SWR port params.

Change-Id: Id839cc908fb5f7843e5fd6260b3205c8844349ba
Signed-off-by: Matthew Rice <[email protected]>
Matthew Rice 3 years ago
parent
commit
2e70df2efe
1 changed files with 2 additions and 2 deletions
  1. 2 2
      asoc/codecs/wsa884x/wsa884x.c

+ 2 - 2
asoc/codecs/wsa884x/wsa884x.c

@@ -2195,12 +2195,12 @@ static int wsa884x_swr_probe(struct swr_device *pdev)
 			REG_FIELD_VALUE(TOP_CTRL1,
 			OCP_LOWVBAT_ITH_SEL_EN, 0x00));
 	ret = wsa884x_parse_port_params(&pdev->dev, "qcom,swr-wsa-port-params");
-	swr_init_port_params(wsa884x->swr_slave, WSA884X_MAX_SWR_PORTS,
-		wsa884x->swr_wsa_port_params);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to read port params\n");
 		goto err;
 	}
+	swr_init_port_params(wsa884x->swr_slave, WSA884X_MAX_SWR_PORTS,
+		wsa884x->swr_wsa_port_params);
 	mutex_init(&wsa884x->res_lock);
 
 #ifdef CONFIG_DEBUG_FS