drm/radeon/kms/atom: use get_unaligned() for ctx->ps
diff mbox

Message ID 1265860601-2915-1-git-send-email-mattst88@gmail.com
State Accepted
Headers show

Commit Message

Matt Turner Feb. 11, 2010, 3:56 a.m. UTC
None

Patch
diff mbox

diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index bd0c843..c1d3c24 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -24,6 +24,7 @@ 
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <asm/unaligned.h>
 
 #define ATOM_DEBUG
 
@@ -212,7 +213,9 @@  static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,
 	case ATOM_ARG_PS:
 		idx = U8(*ptr);
 		(*ptr)++;
-		val = le32_to_cpu(ctx->ps[idx]);
+		/* get_unaligned avoids unaligned accesses from atombios tables
+		 * 21, 24, 42. */
+		val = le32_to_cpu(get_unaligned((u32 *)&ctx->ps[idx]));
 		if (print)
 			DEBUG("PS[0x%02X,0x%04X]", idx, val);
 		break;