Skip to contentSkip to conversation

isdn/eicon: msg_in_{wrap,read}_pos assigned twice?

DISCUSSION roel kluin 2 participants 2 messages Jul 25, 2008 – Jul 28, 2008

lore
Share & tools
lore

roel kluin

author
#0 lore raw

vi drivers/isdn/hardware/eicon/message.c +4035

and note two similar tests on line 4035 and 4049:

[else] if (plci->msg_in_read_pos == plci->msg_in_wrap_pos)

after the first test:

	plci->msg_in_wrap_pos = MSG_IN_QUEUE_SIZE;
	plci->msg_in_read_pos = i + MSG_IN_OVERHEAD;

but then after the second test as well:

	plci->msg_in_read_pos = MSG_IN_QUEUE_SIZE;
	plci->msg_in_wrap_pos = MSG_IN_QUEUE_SIZE;

So the assignment after the first test has no effect. Is this a bug?

Roel Kluin

#1 lore raw
Quoted 11 lines · roel kluin

vi drivers/isdn/hardware/eicon/message.c +4035

and note two similar tests on line 4035 and 4049:

[else] if (plci->msg_in_read_pos == plci->msg_in_wrap_pos)

after the first test:

	plci->msg_in_wrap_pos = MSG_IN_QUEUE_SIZE;
	plci->msg_in_read_pos = i + MSG_IN_OVERHEAD;
Quoted 7 lines

but then after the second test as well:

	plci->msg_in_read_pos = MSG_IN_QUEUE_SIZE;
	plci->msg_in_wrap_pos = MSG_IN_QUEUE_SIZE;

So the assignment after the first test has no effect. Is this a bug?

If (plci->msg_in_read_pos == plci->msg_in_wrap_pos) is true in the first test it can't be true in the second. So the code could be optimized a bit. But the first assignments are needed.

If it's false in the first it may become true in the second. So it's not a bug. All conditions are really needed.

Armin