Skip to content

Commit

Permalink
media: cec-pin: fix broken tx_ignore_nack_until_eom error injection
Browse files Browse the repository at this point in the history
If the tx_ignore_nack_until_eom error injection was activated,
then tx_nacked was never set instead of setting it when the last
byte of the message was transmitted.

As a result the transmit was marked as OK, when it should have
been NACKed.

Modify the condition so that it always sets tx_nacked when the
last byte of the message was transmitted.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org>      # for v4.17 and up
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Nov 23, 2018
1 parent 02e6d2e commit ac791f1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/media/cec/cec-pin.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,9 @@ static void cec_pin_tx_states(struct cec_pin *pin, ktime_t ts)
break;
/* Was the message ACKed? */
ack = cec_msg_is_broadcast(&pin->tx_msg) ? v : !v;
if (!ack && !pin->tx_ignore_nack_until_eom &&
pin->tx_bit / 10 < pin->tx_msg.len && !pin->tx_post_eom) {
if (!ack && (!pin->tx_ignore_nack_until_eom ||
pin->tx_bit / 10 == pin->tx_msg.len - 1) &&
!pin->tx_post_eom) {
/*
* Note: the CEC spec is ambiguous regarding
* what action to take when a NACK appears
Expand Down

0 comments on commit ac791f1

Please sign in to comment.