[PATCH v5.10-rt] rt: dma: fix build issue in at_hdmac

Luis Claudio R. Goncalves
2024-08-16T00:41:12Z

The functions atc_advance_work() and atc_issue_pending() both have a
similar statement

return spin_unlock_irqrestore(&atchan->lock, flags);

That results in the following errors during the build:

drivers/dma/at_hdmac.c: In function ‘atc_advance_work’:
./include/linux/spinlock_rt.h:115:9: error: expected expression before ‘do’
115 | do { \
| ^~
drivers/dma/at_hdmac.c:487:24: note: in expansion of macro ‘spin_unlock_irqrestore’
487 | return spin_unlock_irqrestore(&atchan->lock, flags);
| ^~~~~~~~~~~~~~~~~~~~~~
./include/linux/spinlock_rt.h:115:9: error: ‘return’ with a value, in function returning void [-Werror=return-type]
115 | do { \
| ^~
drivers/dma/at_hdmac.c:487:24: note: in expansion of macro ‘spin_unlock_irqrestore’
487 | return spin_unlock_irqrestore(&atchan->lock, flags);
| ^~~~~~~~~~~~~~~~~~~~~~

Fix this by splitting the spin_unlock_irqrestore() call and the return
statement in both functions.

Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
---
drivers/dma/at_hdmac.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

Many thanks to Daniel Wagner who spotted and reported this build issue!

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 6a4f9697b574..bdbd85adeea9 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -483,8 +483,10 @@ static void atc_advance_work(struct at_dma_chan *atchan)
dev_vdbg(chan2dev(&atchan->chan_common), "advance_work\n");

spin_lock_irqsave(&atchan->lock, flags);
- if (atc_chan_is_enabled(atchan) || list_empty(&atchan->active_list))
- return spin_unlock_irqrestore(&atchan->lock, flags);
+ if (atc_chan_is_enabled(atchan) || list_empty(&atchan->active_list)) {
+ spin_unlock_irqrestore(&atchan->lock, flags);
+ return;
+ }

desc = atc_first_active(atchan);
/* Remove the transfer node from the active list. */
@@ -1477,8 +1479,10 @@ static void atc_issue_pending(struct dma_chan *chan)
dev_vdbg(chan2dev(chan), "issue_pending\n");

spin_lock_irqsave(&atchan->lock, flags);
- if (atc_chan_is_enabled(atchan) || list_empty(&atchan->queue))
- return spin_unlock_irqrestore(&atchan->lock, flags);
+ if (atc_chan_is_enabled(atchan) || list_empty(&atchan->queue)) {
+ spin_unlock_irqrestore(&atchan->lock, flags);
+ return;
+ }

desc = atc_first_queued(atchan);
list_move_tail(&desc->desc_node, &atchan->active_list);
--
2.46.0