提交 c6bf811a 编写于 作者: T Tom Gundersen 提交者: Sean Paul

drm: Distinguish no name from ENOMEM in set_unique()

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: NTom Gundersen <teg@jklm.no>
Signed-off-by: NSean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20160921145919.13754-1-teg@jklm.no
上级 f566911a
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册