LinuxTV Patchwork media: sunxi: cedrus: Fix missing error message context

login
register
mail settings
Submitter Ond?ej Jirman
Date Dec. 21, 2018, 4:56 p.m.
Message ID <20181221165641.16207-1-megous@megous.com>
Download mbox | patch
Permalink /patch/53615/
State Accepted
Delegated to: Hans Verkuil
Headers show

Comments

Ond?ej Jirman - Dec. 21, 2018, 4:56 p.m.
From: Ondrej Jirman <megous@megous.com>

When cedrus_hw_probe is called, v4l2_dev is not yet initialized.
Use dev_err instead.

Signed-off-by: Ondrej Jirman <megous@megous.com>
---
 .../staging/media/sunxi/cedrus/cedrus_hw.c    | 28 +++++++++----------
 1 file changed, 14 insertions(+), 14 deletions(-)
Paul Kocialkowski - Dec. 24, 2018, 8:40 a.m.
Hi,

On Fri, 2018-12-21 at 17:56 +0100, megous@megous.com wrote:
> From: Ondrej Jirman <megous@megous.com>
> 
> When cedrus_hw_probe is called, v4l2_dev is not yet initialized.
> Use dev_err instead.

Good catch and thanks for the patch!

Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Cheers,

Paul

> Signed-off-by: Ondrej Jirman <megous@megous.com>
> ---
>  .../staging/media/sunxi/cedrus/cedrus_hw.c    | 28 +++++++++----------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> index 300339fee1bc..0acf219a8c91 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> @@ -157,14 +157,14 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
>  
>  	irq_dec = platform_get_irq(dev->pdev, 0);
>  	if (irq_dec <= 0) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to get IRQ\n");
> +		dev_err(dev->dev, "Failed to get IRQ\n");
>  
>  		return irq_dec;
>  	}
>  	ret = devm_request_irq(dev->dev, irq_dec, cedrus_irq,
>  			       0, dev_name(dev->dev), dev);
>  	if (ret) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to request IRQ\n");
> +		dev_err(dev->dev, "Failed to request IRQ\n");
>  
>  		return ret;
>  	}
> @@ -182,21 +182,21 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
>  
>  	ret = of_reserved_mem_device_init(dev->dev);
>  	if (ret && ret != -ENODEV) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to reserve memory\n");
> +		dev_err(dev->dev, "Failed to reserve memory\n");
>  
>  		return ret;
>  	}
>  
>  	ret = sunxi_sram_claim(dev->dev);
>  	if (ret) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to claim SRAM\n");
> +		dev_err(dev->dev, "Failed to claim SRAM\n");
>  
>  		goto err_mem;
>  	}
>  
>  	dev->ahb_clk = devm_clk_get(dev->dev, "ahb");
>  	if (IS_ERR(dev->ahb_clk)) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to get AHB clock\n");
> +		dev_err(dev->dev, "Failed to get AHB clock\n");
>  
>  		ret = PTR_ERR(dev->ahb_clk);
>  		goto err_sram;
> @@ -204,7 +204,7 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
>  
>  	dev->mod_clk = devm_clk_get(dev->dev, "mod");
>  	if (IS_ERR(dev->mod_clk)) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to get MOD clock\n");
> +		dev_err(dev->dev, "Failed to get MOD clock\n");
>  
>  		ret = PTR_ERR(dev->mod_clk);
>  		goto err_sram;
> @@ -212,7 +212,7 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
>  
>  	dev->ram_clk = devm_clk_get(dev->dev, "ram");
>  	if (IS_ERR(dev->ram_clk)) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to get RAM clock\n");
> +		dev_err(dev->dev, "Failed to get RAM clock\n");
>  
>  		ret = PTR_ERR(dev->ram_clk);
>  		goto err_sram;
> @@ -220,7 +220,7 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
>  
>  	dev->rstc = devm_reset_control_get(dev->dev, NULL);
>  	if (IS_ERR(dev->rstc)) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to get reset control\n");
> +		dev_err(dev->dev, "Failed to get reset control\n");
>  
>  		ret = PTR_ERR(dev->rstc);
>  		goto err_sram;
> @@ -229,7 +229,7 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
>  	res = platform_get_resource(dev->pdev, IORESOURCE_MEM, 0);
>  	dev->base = devm_ioremap_resource(dev->dev, res);
>  	if (IS_ERR(dev->base)) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to map registers\n");
> +		dev_err(dev->dev, "Failed to map registers\n");
>  
>  		ret = PTR_ERR(dev->base);
>  		goto err_sram;
> @@ -237,35 +237,35 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
>  
>  	ret = clk_set_rate(dev->mod_clk, CEDRUS_CLOCK_RATE_DEFAULT);
>  	if (ret) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to set clock rate\n");
> +		dev_err(dev->dev, "Failed to set clock rate\n");
>  
>  		goto err_sram;
>  	}
>  
>  	ret = clk_prepare_enable(dev->ahb_clk);
>  	if (ret) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to enable AHB clock\n");
> +		dev_err(dev->dev, "Failed to enable AHB clock\n");
>  
>  		goto err_sram;
>  	}
>  
>  	ret = clk_prepare_enable(dev->mod_clk);
>  	if (ret) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to enable MOD clock\n");
> +		dev_err(dev->dev, "Failed to enable MOD clock\n");
>  
>  		goto err_ahb_clk;
>  	}
>  
>  	ret = clk_prepare_enable(dev->ram_clk);
>  	if (ret) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to enable RAM clock\n");
> +		dev_err(dev->dev, "Failed to enable RAM clock\n");
>  
>  		goto err_mod_clk;
>  	}
>  
>  	ret = reset_control_reset(dev->rstc);
>  	if (ret) {
> -		v4l2_err(&dev->v4l2_dev, "Failed to apply reset\n");
> +		dev_err(dev->dev, "Failed to apply reset\n");
>  
>  		goto err_ram_clk;
>  	}

Patch

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
index 300339fee1bc..0acf219a8c91 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
@@ -157,14 +157,14 @@  int cedrus_hw_probe(struct cedrus_dev *dev)
 
 	irq_dec = platform_get_irq(dev->pdev, 0);
 	if (irq_dec <= 0) {
-		v4l2_err(&dev->v4l2_dev, "Failed to get IRQ\n");
+		dev_err(dev->dev, "Failed to get IRQ\n");
 
 		return irq_dec;
 	}
 	ret = devm_request_irq(dev->dev, irq_dec, cedrus_irq,
 			       0, dev_name(dev->dev), dev);
 	if (ret) {
-		v4l2_err(&dev->v4l2_dev, "Failed to request IRQ\n");
+		dev_err(dev->dev, "Failed to request IRQ\n");
 
 		return ret;
 	}
@@ -182,21 +182,21 @@  int cedrus_hw_probe(struct cedrus_dev *dev)
 
 	ret = of_reserved_mem_device_init(dev->dev);
 	if (ret && ret != -ENODEV) {
-		v4l2_err(&dev->v4l2_dev, "Failed to reserve memory\n");
+		dev_err(dev->dev, "Failed to reserve memory\n");
 
 		return ret;
 	}
 
 	ret = sunxi_sram_claim(dev->dev);
 	if (ret) {
-		v4l2_err(&dev->v4l2_dev, "Failed to claim SRAM\n");
+		dev_err(dev->dev, "Failed to claim SRAM\n");
 
 		goto err_mem;
 	}
 
 	dev->ahb_clk = devm_clk_get(dev->dev, "ahb");
 	if (IS_ERR(dev->ahb_clk)) {
-		v4l2_err(&dev->v4l2_dev, "Failed to get AHB clock\n");
+		dev_err(dev->dev, "Failed to get AHB clock\n");
 
 		ret = PTR_ERR(dev->ahb_clk);
 		goto err_sram;
@@ -204,7 +204,7 @@  int cedrus_hw_probe(struct cedrus_dev *dev)
 
 	dev->mod_clk = devm_clk_get(dev->dev, "mod");
 	if (IS_ERR(dev->mod_clk)) {
-		v4l2_err(&dev->v4l2_dev, "Failed to get MOD clock\n");
+		dev_err(dev->dev, "Failed to get MOD clock\n");
 
 		ret = PTR_ERR(dev->mod_clk);
 		goto err_sram;
@@ -212,7 +212,7 @@  int cedrus_hw_probe(struct cedrus_dev *dev)
 
 	dev->ram_clk = devm_clk_get(dev->dev, "ram");
 	if (IS_ERR(dev->ram_clk)) {
-		v4l2_err(&dev->v4l2_dev, "Failed to get RAM clock\n");
+		dev_err(dev->dev, "Failed to get RAM clock\n");
 
 		ret = PTR_ERR(dev->ram_clk);
 		goto err_sram;
@@ -220,7 +220,7 @@  int cedrus_hw_probe(struct cedrus_dev *dev)
 
 	dev->rstc = devm_reset_control_get(dev->dev, NULL);
 	if (IS_ERR(dev->rstc)) {
-		v4l2_err(&dev->v4l2_dev, "Failed to get reset control\n");
+		dev_err(dev->dev, "Failed to get reset control\n");
 
 		ret = PTR_ERR(dev->rstc);
 		goto err_sram;
@@ -229,7 +229,7 @@  int cedrus_hw_probe(struct cedrus_dev *dev)
 	res = platform_get_resource(dev->pdev, IORESOURCE_MEM, 0);
 	dev->base = devm_ioremap_resource(dev->dev, res);
 	if (IS_ERR(dev->base)) {
-		v4l2_err(&dev->v4l2_dev, "Failed to map registers\n");
+		dev_err(dev->dev, "Failed to map registers\n");
 
 		ret = PTR_ERR(dev->base);
 		goto err_sram;
@@ -237,35 +237,35 @@  int cedrus_hw_probe(struct cedrus_dev *dev)
 
 	ret = clk_set_rate(dev->mod_clk, CEDRUS_CLOCK_RATE_DEFAULT);
 	if (ret) {
-		v4l2_err(&dev->v4l2_dev, "Failed to set clock rate\n");
+		dev_err(dev->dev, "Failed to set clock rate\n");
 
 		goto err_sram;
 	}
 
 	ret = clk_prepare_enable(dev->ahb_clk);
 	if (ret) {
-		v4l2_err(&dev->v4l2_dev, "Failed to enable AHB clock\n");
+		dev_err(dev->dev, "Failed to enable AHB clock\n");
 
 		goto err_sram;
 	}
 
 	ret = clk_prepare_enable(dev->mod_clk);
 	if (ret) {
-		v4l2_err(&dev->v4l2_dev, "Failed to enable MOD clock\n");
+		dev_err(dev->dev, "Failed to enable MOD clock\n");
 
 		goto err_ahb_clk;
 	}
 
 	ret = clk_prepare_enable(dev->ram_clk);
 	if (ret) {
-		v4l2_err(&dev->v4l2_dev, "Failed to enable RAM clock\n");
+		dev_err(dev->dev, "Failed to enable RAM clock\n");
 
 		goto err_mod_clk;
 	}
 
 	ret = reset_control_reset(dev->rstc);
 	if (ret) {
-		v4l2_err(&dev->v4l2_dev, "Failed to apply reset\n");
+		dev_err(dev->dev, "Failed to apply reset\n");
 
 		goto err_ram_clk;
 	}

Privacy Policy