Re: [PATCH v3 3/8] component: add support for component match array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <rmk+kernel@xxxxxxxxxxxxxxxx>
> ---

[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
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux