aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-02-17 01:45:01 -0500
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-02-17 02:56:21 -0500
commitc572c8bbff13591f6c9f249d4413f79ddda21e61 (patch)
treebaa8c5d1b144adb6a31f2f90d51fb52c43d3f738
parent7b918120489ea004388b7370194222671e657203 (diff)
viafb: NULL dereference on allocation failure in query_edid()
We should handle the allocation here, if only to keep the static checkers happy. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
-rw-r--r--drivers/video/via/via_aux_edid.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/video/via/via_aux_edid.c b/drivers/video/via/via_aux_edid.c
index 03f7a41c8a3f..754d4509033f 100644
--- a/drivers/video/via/via_aux_edid.c
+++ b/drivers/video/via/via_aux_edid.c
@@ -36,10 +36,13 @@ static void query_edid(struct via_aux_drv *drv)
36 unsigned char edid[EDID_LENGTH]; 36 unsigned char edid[EDID_LENGTH];
37 bool valid = false; 37 bool valid = false;
38 38
39 if (spec) 39 if (spec) {
40 fb_destroy_modedb(spec->modedb); 40 fb_destroy_modedb(spec->modedb);
41 else 41 } else {
42 spec = kmalloc(sizeof(*spec), GFP_KERNEL); 42 spec = kmalloc(sizeof(*spec), GFP_KERNEL);
43 if (!spec)
44 return;
45 }
43 46
44 spec->version = spec->revision = 0; 47 spec->version = spec->revision = 0;
45 if (via_aux_read(drv, 0x00, edid, EDID_LENGTH)) { 48 if (via_aux_read(drv, 0x00, edid, EDID_LENGTH)) {