Hi Russell
> Add support for generating a set of component matches at master probe
> time, and submitting them to the component layer. This allows the
> component layer to perform the matches internally without needing to
> call into the master driver, and allows for further restructuring of
> the component helper.
>
> Signed-off-by: Russell King <[email protected]>
> ---
[snip]
> +int component_master_add_with_match(struct device *dev,
> + const struct component_master_ops *ops,
> + struct component_match *match)
> {
> struct master *master;
> int ret;
>
> + if (ops->add_components && match)
> + return -EINVAL;
> +
> + /* Reallocate the match array for its true size */
> + match = component_match_realloc(dev, match, match->num);
^^^^^^^^^^^^^
This gives a NULL pointer dereference error when match is NULL (as passed
by component_master_add() below). Observed this while testing linux-next
kernel (next-20140704) on Exynos based board with DRM enabled.
> + if (IS_ERR(match))
> + return PTR_ERR(match);
> +
> master = kzalloc(sizeof(*master), GFP_KERNEL);
> if (!master)
> return -ENOMEM;
>
> master->dev = dev;
> master->ops = ops;
> + master->match = match;
> INIT_LIST_HEAD(&master->components);
>
> /* Add to the list of available masters. */
> @@ -215,6 +322,13 @@ int component_master_add(struct device *dev,
>
> return ret < 0 ? ret : 0;
> }
> +EXPORT_SYMBOL_GPL(component_master_add_with_match);
> +
> +int component_master_add(struct device *dev,
> + const struct component_master_ops *ops)
> +{
> + return component_master_add_with_match(dev, ops, NULL);
> +}
> EXPORT_SYMBOL_GPL(component_master_add);
--
Regards,
Sachin.
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel