Skip to contentSkip to conversation

lirc_dev: fix regression in feature check logic in ioctl

PATCH In review Alexey Ignatov 2 participants 2 messages Apr 3, 2017 – Apr 4, 2017

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

PATCH 1/1 lirc_dev: fix regression in feature check logic in ioctl

Commit 273b902a5b1bfd6977a73c4de3eb96db3cb103cb removed inversion in features check conditionals (by accident, perhaps). That change resulted in erroneous reporting that device can't receive while actually it can. Fix this.

---
 drivers/media/rc/lirc_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/rc/lirc_dev.c +2 -2
index e65bc9fd1d23..cd07af05be69 100644
@@ -591,7 +591,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		result = put_user(ir->d.features, (__u32 __user *)arg);
 		break;
 	case LIRC_GET_REC_MODE:
-		if (LIRC_CAN_REC(ir->d.features)) {
+		if (!LIRC_CAN_REC(ir->d.features)) {
 			result = -ENOTTY;
 			break;
 		}
@@ -601,7 +601,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 				  (__u32 __user *)arg);
 		break;
 	case LIRC_SET_REC_MODE:
-		if (LIRC_CAN_REC(ir->d.features)) {
+		if (!LIRC_CAN_REC(ir->d.features)) {
 			result = -ENOTTY;
 			break;
 		}
Signature · 1 line
2.11.0
#1 lore raw

Hi Alexey,

this has been already fixed in commit bd291208d7f5 ("[media]
lirc_dev: LIRC_{G,S}ET_REC_MODE do not work") by Sean.

You need to update your kernel or cherry-pick this patch.

In any case, for future patches of this kind, some notes through the lines:

Quoted 1 line · Alexey Ignatov

Commit 273b902a5b1bfd6977a73c4de3eb96db3cb103cb removed inversion in

References to commit should be of the kind:

Commit 273b902a5b1b ("[media] lirc_dev: use LIRC_CAN_REC() define to check if the device can receive")

Please run checkpatch.pl before sending the patch.

Quoted 5 lines

features check conditionals (by accident, perhaps). That change resulted in erroneous reporting that device can't receive while actually it can. Fix this.

Here goes:

Fixes 273b902a5b1b ("[media] lirc_dev: use LIRC_CAN_REC() define to check if the device can receive")

because it fixes a bug (check Sean's patch).

Thanks,
Andi