1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-28 23:43:42 +02:00

Simplify get_next_write in the partial write code

Suggested by Michael Karcher.

Corresponding to flashrom svn r1246.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
This commit is contained in:
Carl-Daniel Hailfinger 2010-12-06 13:05:44 +00:00
parent 9188240a14
commit 202bf5337d

View File

@ -928,13 +928,11 @@ static int get_next_write(uint8_t *have, uint8_t *want, int len,
/* First location where have and want /* First location where have and want
* do not differ anymore. * do not differ anymore.
*/ */
first_len = i * stride - rel_start;
break; break;
} }
} }
} }
/* Did the loop terminate without setting first_len? */ if (need_write)
if (need_write && ! first_len)
first_len = min(i * stride - rel_start, len); first_len = min(i * stride - rel_start, len);
*first_start += rel_start; *first_start += rel_start;
return first_len; return first_len;