Skip to contentSkip to conversation

media: lirc: drop trailing space from scancode transmit

git:media_stage/master Hans Verkuil 1 participant 1 message Oct 11, 2023

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

This is an automatic generated email to let you know that the following patch were queued:

Subject: media: lirc: drop trailing space from scancode transmit
Author:  Sean Young <[email protected]>
Date:    Fri Oct 6 22:31:52 2023 +0100

When transmitting, infrared drivers expect an odd number of samples; iow without a trailing space. No problems have been observed so far, so this is just belt and braces.

Fixes 9b6192589be7 ("media: lirc: implement scancode sending")
 drivers/media/rc/lirc_dev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

---

drivers/media/rc/lirc_dev.c +5 -1
index 043d23aaa3cb..a537734832c5 100644
@@ -276,7 +276,11 @@ static ssize_t lirc_transmit(struct file *file, const char __user *buf,
 		if (ret < 0)
 			goto out_kfree_raw;
 
-		count = ret;
+		/* drop trailing space */
+		if (!(ret % 2))
+			count = ret - 1;
+		else
+			count = ret;
 
 		txbuf = kmalloc_array(count, sizeof(unsigned int), GFP_KERNEL);
 		if (!txbuf) {