Skip to contentSkip to conversation

ASoC: fsl_sai: Improve error handling

PATCH New [email protected] 1 participant 3 messages Nov 10

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ASoC: fsl_sai: Improve error handling

From: bui duc phuc <[email protected]>

Hi all,

This series includes two follow-up changes for the FSL SAI driver, covering hardware reset handling and dataline configuration error reporting.

Complie-tested only.

Best regards,
Phuc

bui duc phuc (2):
ASoC: fsl_sai: Make fsl_sai_reset_hw() return void
ASoC: fsl_sai: Report dataline configuration read errors

 sound/soc/fsl/fsl_sai.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 ASoC: fsl_sai: Make fsl_sai_reset_hw() return void

From: bui duc phuc <[email protected]>

fsl_sai_reset_hw() has a single caller, which does not need to handle its return value. The function already reports register write failures through dev_err().

Change the return type to void and continue clearing RCSR even if clearing TCSR fails.

---
 sound/soc/fsl/fsl_sai.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
sound/soc/fsl/fsl_sai.c +3 -9
index 430e896d064e..59c9b8c28133 100644
@@ -1410,7 +1410,7 @@ static int fsl_sai_check_version(struct device *dev)
 	return 0;
 }
 
-static int fsl_sai_reset_hw(struct device *dev)
+static void fsl_sai_reset_hw(struct device *dev)
 {
 	struct fsl_sai *sai = dev_get_drvdata(dev);
 	unsigned char ofs = sai->soc_data->reg_offset;
@@ -1421,18 +1421,12 @@ static int fsl_sai_reset_hw(struct device *dev)
 	 * Bootloader may leave SAI running causing interrupt storm.
 	 */
 	ret = regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), 0);
-	if (ret) {
+	if (ret)
 		dev_err(dev, "Failed to clear TCSR: %d\n", ret);
-		return ret;
-	}
 
 	ret = regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), 0);
-	if (ret) {
+	if (ret)
 		dev_err(dev, "Failed to clear RCSR: %d\n", ret);
-		return ret;
-	}
-
-	return 0;
 }
 
 /*
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/2 ASoC: fsl_sai: Report dataline configuration read errors

In reply to [email protected]

From: bui duc phuc <[email protected]>

fsl_sai_read_dlcfg() returns errors from of_property_read_u32_index() without reporting them.

Add a dev_err() call in fsl_sai_probe() to report failures returned by fsl_sai_read_dlcfg().

---
 sound/soc/fsl/fsl_sai.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/fsl/fsl_sai.c +3 -1
index 59c9b8c28133..16197f9ac2d8 100644
@@ -1621,8 +1621,10 @@ static int fsl_sai_probe(struct platform_device *pdev)
 
 	/* read dataline mask for rx and tx*/
 	ret = fsl_sai_read_dlcfg(sai);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_err(dev, "failed to read dlcfg %d\n", ret);
 		return ret;
+	}
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
Signature · 1 line
2.43.0