lib/edid: Zero struct only when used

Change-Id: I1c14e7458153fb992b17f30d7015321fae533bb2
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38913
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
diff --git a/src/lib/edid.c b/src/lib/edid.c
index 238fed5..048cc6a 100644
--- a/src/lib/edid.c
+++ b/src/lib/edid.c
@@ -1138,8 +1138,6 @@
 	    .conformant = EDID_CONFORMANT,
 	};
 
-	memset(out, 0, sizeof(*out));
-
 	if (!edid) {
 		printk(BIOS_ERR, "No EDID found\n");
 		return EDID_ABSENT;
@@ -1152,6 +1150,8 @@
 		return EDID_ABSENT;
 	}
 
+	memset(out, 0, sizeof(*out));
+
 	if (manufacturer_name(edid + 0x08, out->manufacturer_name))
 		c.manufacturer_name_well_formed = 1;