[PATCH] soc: ti: pruss: fix return check for of_device_get_match_data()

Grzegorz Jaszczyk grzegorz.jaszczyk at linaro.org
Tue Nov 10 03:28:58 EST 2020


Hi

On Tue, 10 Nov 2020 at 02:31, Luo Meng <luomeng12 at huawei.com> wrote:
>
> of_device_get_match_data() maybe return NULL pointer which cannot
> be checked with IS_ERR.
>
> Fixes: ba59c9b43c86 ("soc: ti: pruss: support CORECLK_MUX and IEPCLK_MUX")
> Reported-by: Hulk Robot <hulkci at huawei.com>
> Signed-off-by: Luo Meng <luomeng12 at huawei.com>
> ---
>  drivers/soc/ti/pruss.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
> index cc0b4ad7a3d3..582f48051c30 100644
> --- a/drivers/soc/ti/pruss.c
> +++ b/drivers/soc/ti/pruss.c
> @@ -126,7 +126,7 @@ static int pruss_clk_init(struct pruss *pruss, struct device_node *cfg_node)
>         int ret = 0;
>
>         data = of_device_get_match_data(dev);
> -       if (IS_ERR(data))
> +       if (!data)
>                 return -ENODEV;
>
>         clks_np = of_get_child_by_name(cfg_node, "clocks");
> @@ -175,7 +175,7 @@ static int pruss_probe(struct platform_device *pdev)
>         const char *mem_names[PRUSS_MEM_MAX] = { "dram0", "dram1", "shrdram2" };
>
>         data = of_device_get_match_data(&pdev->dev);
> -       if (IS_ERR(data)) {
> +       if (!data) {

Thank you for your interest but with your patch the driver will not be
functional anymore for all devices without match data (e.g.
"ti,am3356-pruss") which is not what we want. The proper fix was
already posted end of October:
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20201026144943.30821-1-grzegorz.jaszczyk@linaro.org/

Thank you,
Grzegorz



More information about the linux-arm-kernel mailing list