Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Fix an error pointer dereference()

The drm_mode_create_tile_group() is only called from
drm_parse_tiled_block() and the caller expects it to return a NULL on
error. In other words, this function should match
drm_mode_get_tile_group().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181217065733.GA12159@kadam

authored by

Dan Carpenter and committed by
Daniel Vetter
705c8160 706246c7

+3 -3
+3 -3
drivers/gpu/drm/drm_connector.c
··· 1960 1960 * identifier for the tile group. 1961 1961 * 1962 1962 * RETURNS: 1963 - * new tile group or error. 1963 + * new tile group or NULL. 1964 1964 */ 1965 1965 struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev, 1966 1966 char topology[8]) ··· 1970 1970 1971 1971 tg = kzalloc(sizeof(*tg), GFP_KERNEL); 1972 1972 if (!tg) 1973 - return ERR_PTR(-ENOMEM); 1973 + return NULL; 1974 1974 1975 1975 kref_init(&tg->refcount); 1976 1976 memcpy(tg->group_data, topology, 8); ··· 1982 1982 tg->id = ret; 1983 1983 } else { 1984 1984 kfree(tg); 1985 - tg = ERR_PTR(ret); 1985 + tg = NULL; 1986 1986 } 1987 1987 1988 1988 mutex_unlock(&dev->mode_config.idr_mutex);