Skip to content

Commit

Permalink
drm: Distinguish no name from ENOMEM in set_unique()
Browse files Browse the repository at this point in the history
If passing name == NULL to drm_drv_set_unique() we now get -ENOMEM
as kstrdup() returns NULL. Instead check for this explicitly and
return -EINVAL if no name is provided.

Signed-off-by: Tom Gundersen <[email protected]>
Signed-off-by: Sean Paul <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
teg authored and atseanpaul committed Sep 22, 2016
1 parent f566911 commit c6bf811
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/drm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ void drm_minor_release(struct drm_minor *minor)

static int drm_dev_set_unique(struct drm_device *dev, const char *name)
{
if (!name)
return -EINVAL;

kfree(dev->unique);
dev->unique = kstrdup(name, GFP_KERNEL);

Expand Down

0 comments on commit c6bf811

Please sign in to comment.