Commit b509cc80 authored by Russell King's avatar Russell King

component: fix bug with legacy API

Sachin Kamat reports that "component: add support for component match
array" broke Exynos DRM due to a NULL pointer deref.  Fix this.
Reported-by: default avatarSachin Kamat <sachin.kamat@samsung.com>
Tested-by: default avatarSachin Kamat <sachin.kamat@samsung.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 6955b582
...@@ -293,10 +293,12 @@ int component_master_add_with_match(struct device *dev, ...@@ -293,10 +293,12 @@ int component_master_add_with_match(struct device *dev,
if (ops->add_components && match) if (ops->add_components && match)
return -EINVAL; return -EINVAL;
if (match) {
/* Reallocate the match array for its true size */ /* Reallocate the match array for its true size */
match = component_match_realloc(dev, match, match->num); match = component_match_realloc(dev, match, match->num);
if (IS_ERR(match)) if (IS_ERR(match))
return PTR_ERR(match); return PTR_ERR(match);
}
master = kzalloc(sizeof(*master), GFP_KERNEL); master = kzalloc(sizeof(*master), GFP_KERNEL);
if (!master) if (!master)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment