On Mon Jul 13 13:08:40 2026 +0100, Sean Young wrote:
> In the allocation failure error path, the transmitting boolean is not
> cleared. If this error path is followed the transmitter cannot be
> used again until the device is replugged or the module reloaded.
> 
> Fix the error path by moving the assignment statement.
> 
> Remove the check for the transmitting state in transmit, since rc-core
> ensures there is never a reentrant call to the driver transmit function;
> the transmit function is always called with dev->lock held.
> 
> The transmitting boolean is only used for interpretting firmware errors.
> 
> Fixes: fac59136bc22 ("[media] RedRat3: Return directly after a failed 
> kcalloc() in redrat3_transmit_ir()")"
> Signed-off-by: Sean Young <[email protected]>
> Cc: [email protected]
> Reviewed-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Sean Young

 drivers/media/rc/redrat3.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

---

diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index 30111deb6013..b07ff832a938 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -773,17 +773,9 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, 
unsigned *txbuf,
        u8 curlencheck = 0;
        unsigned i, sendbuf_len;
 
-       if (rr3->transmitting) {
-               dev_warn(dev, "%s: transmitter already in use\n", __func__);
-               return -EAGAIN;
-       }
-
        if (count > RR3_MAX_SIG_SIZE - RR3_TX_TRAILER_LEN)
                return -EINVAL;
 
-       /* rr3 will disable rc detector on transmit */
-       rr3->transmitting = true;
-
        sample_lens = kzalloc_objs(*sample_lens, RR3_DRIVER_MAXLENS);
        if (!sample_lens)
                return -ENOMEM;
@@ -794,6 +786,9 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, 
unsigned *txbuf,
                goto out;
        }
 
+       /* rr3 will disable rc detector on transmit */
+       rr3->transmitting = true;
+
        for (i = 0; i < count; i++) {
                cur_sample_len = redrat3_us_to_len(txbuf[i]);
                if (cur_sample_len > 0xffff) {
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to