drm: drm_debugfs, check kmalloc retval

Check kmalloc return value in drm_debugfs_create_files and bail out
appropriately if the pointer is NULL.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
This commit is contained in:
Jiri Slaby 2009-07-13 23:20:20 +02:00 committed by Dave Airlie
parent 069a9dce38
commit d25e3a6faa
1 changed files with 4 additions and 0 deletions

View File

@ -101,6 +101,10 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count,
continue;
tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
if (tmp == NULL) {
ret = -1;
goto fail;
}
ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
root, tmp, &drm_debugfs_fops);
if (!ent) {