linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: ti: pruss: Remove wrong check against *get_match_data return value
@ 2020-10-26 14:49 Grzegorz Jaszczyk
  2020-11-10 20:42 ` Suman Anna
  0 siblings, 1 reply; 3+ messages in thread
From: Grzegorz Jaszczyk @ 2020-10-26 14:49 UTC (permalink / raw)
  To: ssantosh, s-anna
  Cc: grzegorz.jaszczyk, santosh.shilimkar, lee.jones, linux-kernel,
	linux-omap, linux-arm-kernel, praneeth, tony, Wei Yongjun

Since the of_device_get_match_data() doesn't return error code, remove
wrong IS_ERR test. Proper check against NULL pointer is already done
later before usage: if (data && data->...).

Additionally, proceeding with empty device data is valid (e.g. in case
of "ti,am3356-pruss").

Reported-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
---
 drivers/soc/ti/pruss.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index cc0b4ad7a3d3..5d6e7132a5c4 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -126,8 +126,6 @@ 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))
-		return -ENODEV;
 
 	clks_np = of_get_child_by_name(cfg_node, "clocks");
 	if (!clks_np) {
@@ -175,10 +173,6 @@ 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)) {
-		dev_err(dev, "missing private data\n");
-		return -ENODEV;
-	}
 
 	ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
 	if (ret) {
-- 
2.29.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] soc: ti: pruss: Remove wrong check against *get_match_data return value
  2020-10-26 14:49 [PATCH] soc: ti: pruss: Remove wrong check against *get_match_data return value Grzegorz Jaszczyk
@ 2020-11-10 20:42 ` Suman Anna
  2020-11-16 17:17   ` Grzegorz Jaszczyk
  0 siblings, 1 reply; 3+ messages in thread
From: Suman Anna @ 2020-11-10 20:42 UTC (permalink / raw)
  To: Grzegorz Jaszczyk, ssantosh
  Cc: santosh.shilimkar, lee.jones, linux-kernel, linux-omap,
	linux-arm-kernel, praneeth, tony, Wei Yongjun

Hi Greg,

On 10/26/20 9:49 AM, Grzegorz Jaszczyk wrote:
> Since the of_device_get_match_data() doesn't return error code, remove
> wrong IS_ERR test. Proper check against NULL pointer is already done
> later before usage: if (data && data->...).
> 
> Additionally, proceeding with empty device data is valid (e.g. in case
> of "ti,am3356-pruss").
> 
> Reported-by: Wei Yongjun <weiyongjun1@huawei.com>

Please add the appropriate Fixes: tag.

And prefer %s/Remove/Fix/ in patch title.

With that,
Acked-by: Suman Anna <s-anna@ti.com>

regards
Suman

> Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
> ---
>  drivers/soc/ti/pruss.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
> index cc0b4ad7a3d3..5d6e7132a5c4 100644
> --- a/drivers/soc/ti/pruss.c
> +++ b/drivers/soc/ti/pruss.c
> @@ -126,8 +126,6 @@ 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))
> -		return -ENODEV;
>  
>  	clks_np = of_get_child_by_name(cfg_node, "clocks");
>  	if (!clks_np) {
> @@ -175,10 +173,6 @@ 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)) {
> -		dev_err(dev, "missing private data\n");
> -		return -ENODEV;
> -	}
>  
>  	ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
>  	if (ret) {
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] soc: ti: pruss: Remove wrong check against *get_match_data return value
  2020-11-10 20:42 ` Suman Anna
@ 2020-11-16 17:17   ` Grzegorz Jaszczyk
  0 siblings, 0 replies; 3+ messages in thread
From: Grzegorz Jaszczyk @ 2020-11-16 17:17 UTC (permalink / raw)
  To: Suman Anna
  Cc: Santosh Shilimkar, Santosh Shilimkar, Lee Jones, linux-kernel,
	linux-omap, linux-arm-kernel, Bajjuri, Praneeth, tony,
	Wei Yongjun

Hi Suman,

On Tue, 10 Nov 2020 at 21:43, Suman Anna <s-anna@ti.com> wrote:
>
> Hi Greg,
>
> On 10/26/20 9:49 AM, Grzegorz Jaszczyk wrote:
> > Since the of_device_get_match_data() doesn't return error code, remove
> > wrong IS_ERR test. Proper check against NULL pointer is already done
> > later before usage: if (data && data->...).
> >
> > Additionally, proceeding with empty device data is valid (e.g. in case
> > of "ti,am3356-pruss").
> >
> > Reported-by: Wei Yongjun <weiyongjun1@huawei.com>
>
> Please add the appropriate Fixes: tag.
>
> And prefer %s/Remove/Fix/ in patch title.

Sure.

>
> With that,
> Acked-by: Suman Anna <s-anna@ti.com>

Thank you, I will post v2 with all improvements soon.
Best regards,
Grzegorz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-16 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 14:49 [PATCH] soc: ti: pruss: Remove wrong check against *get_match_data return value Grzegorz Jaszczyk
2020-11-10 20:42 ` Suman Anna
2020-11-16 17:17   ` Grzegorz Jaszczyk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).