aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2013-07-08 16:33:09 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-07-30 16:04:23 -0400
commit671ea6707b3fb051ec1bae8e7aa0a91f90e178e0 (patch)
treeb403d588b2f200677d6be3a34c859b43aa347c64 /drivers/media/rc
parent25379bf8bc4d4e83bd74d823048b85a95ae5a521 (diff)
[media] lirc: make transmit interface consistent
All lirc drivers that can transmit, return EINVAL when they are passed more than IR data than they can send. That is, except for two drivers which I touched. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/iguanair.c4
-rw-r--r--drivers/media/rc/redrat3.c7
2 files changed, 6 insertions, 5 deletions
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
index a4ab2e6b3f82..19632b1c2190 100644
--- a/drivers/media/rc/iguanair.c
+++ b/drivers/media/rc/iguanair.c
@@ -364,8 +364,8 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count)
364 periods = DIV_ROUND_CLOSEST(txbuf[i] * ir->carrier, 1000000); 364 periods = DIV_ROUND_CLOSEST(txbuf[i] * ir->carrier, 1000000);
365 bytes = DIV_ROUND_UP(periods, 127); 365 bytes = DIV_ROUND_UP(periods, 127);
366 if (size + bytes > ir->bufsize) { 366 if (size + bytes > ir->bufsize) {
367 count = i; 367 rc = -EINVAL;
368 break; 368 goto out;
369 } 369 }
370 while (periods > 127) { 370 while (periods > 127) {
371 ir->packet->payload[size++] = 127 | space; 371 ir->packet->payload[size++] = 127 | space;
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index 37494433dc9f..0042367b060c 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -762,7 +762,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,
762 return -EAGAIN; 762 return -EAGAIN;
763 } 763 }
764 764
765 count = min_t(unsigned, count, RR3_MAX_SIG_SIZE - RR3_TX_TRAILER_LEN); 765 if (count > RR3_MAX_SIG_SIZE - RR3_TX_TRAILER_LEN)
766 return -EINVAL;
766 767
767 /* rr3 will disable rc detector on transmit */ 768 /* rr3 will disable rc detector on transmit */
768 rr3->transmitting = true; 769 rr3->transmitting = true;
@@ -801,8 +802,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,
801 &irdata->lens[curlencheck]); 802 &irdata->lens[curlencheck]);
802 curlencheck++; 803 curlencheck++;
803 } else { 804 } else {
804 count = i - 1; 805 ret = -EINVAL;
805 break; 806 goto out;
806 } 807 }
807 } 808 }
808 irdata->sigdata[i] = lencheck; 809 irdata->sigdata[i] = lencheck;