aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Beznea <[email protected]>2023-01-30 14:06:41 +0200
committerMark Brown <[email protected]>2023-01-30 18:36:20 +0000
commita4c4161d6eae3ef5f486d1638ef452d9bc1376b0 (patch)
treee991b85b841adad771ee4e5037649f1c45cc346f
parentfa09fa60385abbf99342494b280da8b4aebbc0e9 (diff)
ASoC: mchp-spdifrx: fix return value in case completion times out
wait_for_completion_interruptible_timeout() returns 0 in case of timeout. Check this into account when returning from function. Fixes: ef265c55c1ac ("ASoC: mchp-spdifrx: add driver for SPDIF RX") Signed-off-by: Claudiu Beznea <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
-rw-r--r--sound/soc/atmel/mchp-spdifrx.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/soc/atmel/mchp-spdifrx.c b/sound/soc/atmel/mchp-spdifrx.c
index 2d86e0ec930f..7f359371b31b 100644
--- a/sound/soc/atmel/mchp-spdifrx.c
+++ b/sound/soc/atmel/mchp-spdifrx.c
@@ -524,9 +524,10 @@ static int mchp_spdifrx_cs_get(struct mchp_spdifrx_dev *dev,
ret = wait_for_completion_interruptible_timeout(&ch_stat->done,
msecs_to_jiffies(100));
/* IP might not be started or valid stream might not be present */
- if (ret < 0) {
+ if (ret <= 0) {
dev_dbg(dev->dev, "channel status for channel %d timeout\n",
channel);
+ return ret ? : -ETIMEDOUT;
}
memcpy(uvalue->value.iec958.status, ch_stat->data,
@@ -580,7 +581,7 @@ static int mchp_spdifrx_subcode_ch_get(struct mchp_spdifrx_dev *dev,
dev_dbg(dev->dev, "user data for channel %d timeout\n",
channel);
mchp_spdifrx_isr_blockend_dis(dev);
- return ret;
+ return ret ? : -ETIMEDOUT;
}
spin_lock_irqsave(&user_data->lock, flags);