Commit 202bf533 authored by Carl-Daniel Hailfinger's avatar Carl-Daniel Hailfinger
Browse files

Simplify get_next_write in the partial write code


Suggested by Michael Karcher.

Corresponding to flashrom svn r1246.
Signed-off-by: default avatarCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: default avatarMichael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
parent 9188240a
......@@ -928,13 +928,11 @@ static int get_next_write(uint8_t *have, uint8_t *want, int len,
/* First location where have and want
* do not differ anymore.
*/
first_len = i * stride - rel_start;
break;
}
}
}
/* Did the loop terminate without setting first_len? */
if (need_write && ! first_len)
if (need_write)
first_len = min(i * stride - rel_start, len);
*first_start += rel_start;
return first_len;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment