[media] cec: fix wrong last_la determination
authorHans Verkuil <hverkuil@xs4all.nl>
Tue, 10 Jan 2017 11:44:54 +0000 (09:44 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 30 Jan 2017 13:42:31 +0000 (11:42 -0200)
Due to an incorrect condition the last_la used for the initial attempt at
claiming a logical address could be wrong.

The last_la wasn't converted to a mask when ANDing with type2mask, so that
test was broken.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/cec/cec-adap.c

index ebb5e391b800e0bbbca2fd9da926a4ff191839e0..87a6b65ed3af5f72f176625bcc2bfad7e21b0885 100644 (file)
@@ -1206,7 +1206,7 @@ static int cec_config_thread_func(void *arg)
                las->log_addr[i] = CEC_LOG_ADDR_INVALID;
                if (last_la == CEC_LOG_ADDR_INVALID ||
                    last_la == CEC_LOG_ADDR_UNREGISTERED ||
-                   !(last_la & type2mask[type]))
+                   !((1 << last_la) & type2mask[type]))
                        last_la = la_list[0];
 
                err = cec_config_log_addr(adap, i, last_la);