aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeung-Woo Kim <sw0312.kim@samsung.com>2013-07-02 04:57:04 -0400
committerDave Airlie <airlied@redhat.com>2013-07-03 20:52:50 -0400
commitfe2ef780669d9bbd2f921b247dc79266b00b99ab (patch)
treee907ef6b4c9a7e7129a431e8a2b7275ce0e9975e
parentcf4b91f2d9de7ccc7ca0fb0931d55aaf8569fbc0 (diff)
drm: add assertion for checking null edid to drm_edid_block_valid
If raw_edid of drm_edid_block_vaild() is null, it will crash, so checking in bad label is removed and instead assertion is added at the top of the function. The type of return for the function is bool, so it fixes to return true and false instead of 1 and 0. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_edid.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 2dc1a60a867d..95d6f4b6967c 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -968,6 +968,9 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid)
968 u8 csum = 0; 968 u8 csum = 0;
969 struct edid *edid = (struct edid *)raw_edid; 969 struct edid *edid = (struct edid *)raw_edid;
970 970
971 if (WARN_ON(!raw_edid))
972 return false;
973
971 if (edid_fixup > 8 || edid_fixup < 0) 974 if (edid_fixup > 8 || edid_fixup < 0)
972 edid_fixup = 6; 975 edid_fixup = 6;
973 976
@@ -1010,15 +1013,15 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid)
1010 break; 1013 break;
1011 } 1014 }
1012 1015
1013 return 1; 1016 return true;
1014 1017
1015bad: 1018bad:
1016 if (raw_edid && print_bad_edid) { 1019 if (print_bad_edid) {
1017 printk(KERN_ERR "Raw EDID:\n"); 1020 printk(KERN_ERR "Raw EDID:\n");
1018 print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1, 1021 print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1,
1019 raw_edid, EDID_LENGTH, false); 1022 raw_edid, EDID_LENGTH, false);
1020 } 1023 }
1021 return 0; 1024 return false;
1022} 1025}
1023EXPORT_SYMBOL(drm_edid_block_valid); 1026EXPORT_SYMBOL(drm_edid_block_valid);
1024 1027