summaryrefslogtreecommitdiff
path: root/OvmfPkg/VirtioScsiDxe
diff options
context:
space:
mode:
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2012-10-23 22:16:14 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2012-10-23 22:16:14 +0000
commit151304d96d9abd61a71c9f90eb4a0d0c9f0fc391 (patch)
treeb2c96b4bad3fb731e88a101a75a943c400723b5a /OvmfPkg/VirtioScsiDxe
parent5077d4e5df092cbc254aa344d6cc5f2b5722967d (diff)
downloadedk2-platforms-151304d96d9abd61a71c9f90eb4a0d0c9f0fc391.tar.xz
OvmfPkg VirtioScsiDxe: Fix build with VS2010
Structures should not be directly assigned in EDK II code, since this leads to different behaviours on various compilers. Instead, use ZeroMem to zero out the structures. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13878 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/VirtioScsiDxe')
-rw-r--r--OvmfPkg/VirtioScsiDxe/VirtioScsi.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
index 66f6d31d74..e58dd80df2 100644
--- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
+++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
@@ -413,19 +413,8 @@ VirtioScsiPassThru (
volatile VIRTIO_SCSI_RESP Response;
DESC_INDICES Indices;
- //
- // Zero-initialization of Request & Response with "= { 0 };" doesn't build
- // with gcc-4.4: "undefined reference to `memset'". Direct SetMem() is not
- // allowed as it would cast away the volatile qualifier. Work it around.
- //
- union {
- VIRTIO_SCSI_REQ Request;
- VIRTIO_SCSI_RESP Response;
- } Zero;
-
- SetMem (&Zero, sizeof Zero, 0x00);
- Request = Zero.Request;
- Response = Zero.Response;
+ ZeroMem ((VOID*) &Request, sizeof (Request));
+ ZeroMem ((VOID*) &Response, sizeof (Response));
Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
CopyMem (&TargetValue, Target, sizeof TargetValue);