diff mbox series

[-next] media: intel/ipu6: make use of dev_err_cast_probe()

Message ID 20240828120948.3696243-1-lihongbo22@huawei.com (mailing list archive)
State New
Headers show
Series [-next] media: intel/ipu6: make use of dev_err_cast_probe() | expand

Commit Message

Hongbo Li Aug. 28, 2024, 12:09 p.m. UTC
Using dev_err_cast_probe() to simplify the code.

No functional change.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 drivers/media/pci/intel/ipu6/ipu6.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

Comments

Bingbu Cao Aug. 29, 2024, 2:36 a.m. UTC | #1
Hongbo,

Thanks for your patch.

On 8/28/24 8:09 PM, Hongbo Li wrote:
> Using dev_err_cast_probe() to simplify the code.
> 
> No functional change.
> 
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
> ---
>  drivers/media/pci/intel/ipu6/ipu6.c | 20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c
> index bbd646378ab3..d10cbdd088ab 100644
> --- a/drivers/media/pci/intel/ipu6/ipu6.c
> +++ b/drivers/media/pci/intel/ipu6/ipu6.c
> @@ -390,20 +390,18 @@ ipu6_isys_init(struct pci_dev *pdev, struct device *parent,
>  	isys_adev = ipu6_bus_initialize_device(pdev, parent, pdata, ctrl,
>  					       IPU6_ISYS_NAME);
>  	if (IS_ERR(isys_adev)) {
> -		dev_err_probe(dev, PTR_ERR(isys_adev),
> -			      "ipu6_bus_initialize_device isys failed\n");
>  		kfree(pdata);
> -		return ERR_CAST(isys_adev);
> +		return dev_err_cast_probe(dev, isys_adev,
> +				"ipu6_bus_initialize_device isys failed\n");

The indent here is not correct, ditto for others.

>  	}
>  
>  	isys_adev->mmu = ipu6_mmu_init(dev, base, ISYS_MMID,
>  				       &ipdata->hw_variant);
>  	if (IS_ERR(isys_adev->mmu)) {
> -		dev_err_probe(dev, PTR_ERR(isys_adev->mmu),
> -			      "ipu6_mmu_init(isys_adev->mmu) failed\n");
>  		put_device(&isys_adev->auxdev.dev);
>  		kfree(pdata);
> -		return ERR_CAST(isys_adev->mmu);
> +		return dev_err_cast_probe(dev, isys_adev->mmu,
> +				"ipu6_mmu_init(isys_adev->mmu) failed\n");
>  	}
>  
>  	isys_adev->mmu->dev = &isys_adev->auxdev.dev;
> @@ -436,20 +434,18 @@ ipu6_psys_init(struct pci_dev *pdev, struct device *parent,
>  	psys_adev = ipu6_bus_initialize_device(pdev, parent, pdata, ctrl,
>  					       IPU6_PSYS_NAME);
>  	if (IS_ERR(psys_adev)) {
> -		dev_err_probe(&pdev->dev, PTR_ERR(psys_adev),
> -			      "ipu6_bus_initialize_device psys failed\n");
>  		kfree(pdata);
> -		return ERR_CAST(psys_adev);
> +		return dev_err_cast_probe(&pdev->dev, psys_adev,
> +				"ipu6_bus_initialize_device psys failed\n");
>  	}
>  
>  	psys_adev->mmu = ipu6_mmu_init(&pdev->dev, base, PSYS_MMID,
>  				       &ipdata->hw_variant);
>  	if (IS_ERR(psys_adev->mmu)) {
> -		dev_err_probe(&pdev->dev, PTR_ERR(psys_adev->mmu),
> -			      "ipu6_mmu_init(psys_adev->mmu) failed\n");
>  		put_device(&psys_adev->auxdev.dev);
>  		kfree(pdata);
> -		return ERR_CAST(psys_adev->mmu);
> +		return dev_err_cast_probe(&pdev->dev, psys_adev->mmu,
> +				"ipu6_mmu_init(psys_adev->mmu) failed\n");
>  	}
>  
>  	psys_adev->mmu->dev = &psys_adev->auxdev.dev;
>

I think this change is not essential so far, it will break developers
who are still working on 6.10.

If you plan to use the new helper, IMHO it is better a series of patches
to address all instead of just ipu6 driver.
diff mbox series

Patch

diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c
index bbd646378ab3..d10cbdd088ab 100644
--- a/drivers/media/pci/intel/ipu6/ipu6.c
+++ b/drivers/media/pci/intel/ipu6/ipu6.c
@@ -390,20 +390,18 @@  ipu6_isys_init(struct pci_dev *pdev, struct device *parent,
 	isys_adev = ipu6_bus_initialize_device(pdev, parent, pdata, ctrl,
 					       IPU6_ISYS_NAME);
 	if (IS_ERR(isys_adev)) {
-		dev_err_probe(dev, PTR_ERR(isys_adev),
-			      "ipu6_bus_initialize_device isys failed\n");
 		kfree(pdata);
-		return ERR_CAST(isys_adev);
+		return dev_err_cast_probe(dev, isys_adev,
+				"ipu6_bus_initialize_device isys failed\n");
 	}
 
 	isys_adev->mmu = ipu6_mmu_init(dev, base, ISYS_MMID,
 				       &ipdata->hw_variant);
 	if (IS_ERR(isys_adev->mmu)) {
-		dev_err_probe(dev, PTR_ERR(isys_adev->mmu),
-			      "ipu6_mmu_init(isys_adev->mmu) failed\n");
 		put_device(&isys_adev->auxdev.dev);
 		kfree(pdata);
-		return ERR_CAST(isys_adev->mmu);
+		return dev_err_cast_probe(dev, isys_adev->mmu,
+				"ipu6_mmu_init(isys_adev->mmu) failed\n");
 	}
 
 	isys_adev->mmu->dev = &isys_adev->auxdev.dev;
@@ -436,20 +434,18 @@  ipu6_psys_init(struct pci_dev *pdev, struct device *parent,
 	psys_adev = ipu6_bus_initialize_device(pdev, parent, pdata, ctrl,
 					       IPU6_PSYS_NAME);
 	if (IS_ERR(psys_adev)) {
-		dev_err_probe(&pdev->dev, PTR_ERR(psys_adev),
-			      "ipu6_bus_initialize_device psys failed\n");
 		kfree(pdata);
-		return ERR_CAST(psys_adev);
+		return dev_err_cast_probe(&pdev->dev, psys_adev,
+				"ipu6_bus_initialize_device psys failed\n");
 	}
 
 	psys_adev->mmu = ipu6_mmu_init(&pdev->dev, base, PSYS_MMID,
 				       &ipdata->hw_variant);
 	if (IS_ERR(psys_adev->mmu)) {
-		dev_err_probe(&pdev->dev, PTR_ERR(psys_adev->mmu),
-			      "ipu6_mmu_init(psys_adev->mmu) failed\n");
 		put_device(&psys_adev->auxdev.dev);
 		kfree(pdata);
-		return ERR_CAST(psys_adev->mmu);
+		return dev_err_cast_probe(&pdev->dev, psys_adev->mmu,
+				"ipu6_mmu_init(psys_adev->mmu) failed\n");
 	}
 
 	psys_adev->mmu->dev = &psys_adev->auxdev.dev;