diff options
author | 2014-07-04 13:23:46 +0100 | |
---|---|---|
committer | 2014-07-04 18:05:05 +0100 | |
commit | b509cc802239a8b5ba7d1d2cc5adfb9d984b7ed8 (patch) | |
tree | 476a3a78ff7da58a89b713595945d0946963f3b7 /drivers/base/component.c | |
parent | component: add support for component match array (diff) | |
download | linux-b509cc802239a8b5ba7d1d2cc5adfb9d984b7ed8.tar.gz linux-b509cc802239a8b5ba7d1d2cc5adfb9d984b7ed8.tar.bz2 linux-b509cc802239a8b5ba7d1d2cc5adfb9d984b7ed8.zip |
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: Sachin Kamat <sachin.kamat@samsung.com>
Tested-by: Sachin Kamat <sachin.kamat@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/base/component.c')
-rw-r--r-- | drivers/base/component.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/base/component.c b/drivers/base/component.c index b4236daed4fa..f748430bb654 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -293,10 +293,12 @@ int component_master_add_with_match(struct device *dev, if (ops->add_components && match) return -EINVAL; - /* Reallocate the match array for its true size */ - match = component_match_realloc(dev, match, match->num); - if (IS_ERR(match)) - return PTR_ERR(match); + if (match) { + /* Reallocate the match array for its true size */ + match = component_match_realloc(dev, match, match->num); + if (IS_ERR(match)) + return PTR_ERR(match); + } master = kzalloc(sizeof(*master), GFP_KERNEL); if (!master) |