From 202bf5337dd0a23fcb7068077451c3f0f8cecb87 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Mon, 6 Dec 2010 13:05:44 +0000 Subject: Simplify get_next_write in the partial write code Suggested by Michael Karcher. Corresponding to flashrom svn r1246. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Michael Karcher --- flashrom.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'flashrom.c') diff --git a/flashrom.c b/flashrom.c index ac39a5f..f3497d0 100644 --- a/flashrom.c +++ b/flashrom.c @@ -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; -- cgit v1.1