summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2014-06-21 04:47:58 +0000
committerjsg <jsg@openbsd.org>2014-06-21 04:47:58 +0000
commitbf28fe092559c7918a81bb664c6fb411d2e7729a (patch)
treeecbbf694e7da35d2bded91e534f4583cb88ea29b
parentdrm/radeon: memory leak on bo reservation failure. v2 (diff)
downloadwireguard-openbsd-bf28fe092559c7918a81bb664c6fb411d2e7729a.tar.xz
wireguard-openbsd-bf28fe092559c7918a81bb664c6fb411d2e7729a.zip
drm/radeon/si: make sure mc ucode is loaded before checking the size
From Alex Deucher eed35bff1fe05f3a32989ace86107a1402f18537 in ubuntu 3.8 8c79bae6a30f606b7a4e17c994bc5f72f8fdaf11 in mainline linux
-rw-r--r--sys/dev/pci/drm/radeon/si.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/radeon/si.c b/sys/dev/pci/drm/radeon/si.c
index a7b84fb35ab..9904991f384 100644
--- a/sys/dev/pci/drm/radeon/si.c
+++ b/sys/dev/pci/drm/radeon/si.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: si.c,v 1.13 2014/02/10 01:59:48 jsg Exp $ */
+/* $OpenBSD: si.c,v 1.14 2014/06/21 04:47:58 jsg Exp $ */
/*
* Copyright 2011 Advanced Micro Devices, Inc.
*
@@ -208,11 +208,13 @@ static int si_mc_load_microcode(struct radeon_device *rdev)
const __be32 *fw_data;
u32 running, blackout = 0;
u32 *io_mc_regs;
- int i, ucode_size, regs_size;
+ int i, regs_size, ucode_size;
if (!rdev->mc_fw)
return -EINVAL;
+ ucode_size = rdev->mc_fw_size / 4;
+
switch (rdev->family) {
case CHIP_TAHITI:
io_mc_regs = (u32 *)&tahiti_io_mc_regs;