From: Jarod Wilson Date: Wed, 13 Jul 2011 21:26:06 +0000 (-0300) Subject: [media] redrat3: cap duration in the right place X-Git-Tag: firefly_0821_release~3680^2~4808^2~56 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2c594ffae40306ba1a5a5d59186cd3d49dc3ad6a;p=firefly-linux-kernel-4.4.55.git [media] redrat3: cap duration in the right place Trying to cap duration before multiplying it was obviously wrong. CC: Chris Dodge CC: Andrew Vincer CC: Stephen Cox Signed-off-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 95a9436a2731..ea5039b88c50 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -496,9 +496,6 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3) u16 val = len_vals[data_vals[i]]; single_len = redrat3_len_to_us((u32)be16_to_cpu(val)); - /* cap the value to IR_MAX_DURATION */ - single_len &= IR_MAX_DURATION; - /* we should always get pulse/space/pulse/space samples */ if (i % 2) rawir.pulse = false; @@ -506,6 +503,9 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3) rawir.pulse = true; rawir.duration = US_TO_NS(single_len); + /* cap the value to IR_MAX_DURATION */ + rawir.duration &= IR_MAX_DURATION; + rr3_dbg(dev, "storing %s with duration %d (i: %d)\n", rawir.pulse ? "pulse" : "space", rawir.duration, i); ir_raw_event_store_with_filter(rr3->rc, &rawir);