Re: [PATCH 06/15] PCI: dwc/*: Convert to platform remove callback returning void

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

 



On Tue, Mar 21, 2023 at 08:31:59PM +0100, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is (mostly) ignored
> and this typically results in resource leaks. To improve here there is a
> quest to make the remove callback return void. In the first step of this
> quest all drivers are converted to .remove_new() which already returns
> void.
> 
> Trivially convert the dwc drivers from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> ---
>  drivers/pci/controller/dwc/pcie-bt1.c      | 6 ++----
>  drivers/pci/controller/dwc/pcie-histb.c    | 6 ++----
>  drivers/pci/controller/dwc/pcie-intel-gw.c | 6 ++----
>  drivers/pci/controller/dwc/pcie-qcom-ep.c  | 8 +++-----
>  drivers/pci/controller/dwc/pcie-tegra194.c | 8 +++-----
>  5 files changed, 12 insertions(+), 22 deletions(-)
> 

> diff --git a/drivers/pci/controller/dwc/pcie-bt1.c b/drivers/pci/controller/dwc/pcie-bt1.c
> index 95a723a6fd46..17e696797ff5 100644
> --- a/drivers/pci/controller/dwc/pcie-bt1.c
> +++ b/drivers/pci/controller/dwc/pcie-bt1.c
> @@ -617,13 +617,11 @@ static int bt1_pcie_probe(struct platform_device *pdev)
>  	return bt1_pcie_add_port(btpci);
>  }
>  
> -static int bt1_pcie_remove(struct platform_device *pdev)
> +static void bt1_pcie_remove(struct platform_device *pdev)
>  {
>  	struct bt1_pcie *btpci = platform_get_drvdata(pdev);
>  
>  	bt1_pcie_del_port(btpci);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id bt1_pcie_of_match[] = {
> @@ -634,7 +632,7 @@ MODULE_DEVICE_TABLE(of, bt1_pcie_of_match);
>  
>  static struct platform_driver bt1_pcie_driver = {
>  	.probe = bt1_pcie_probe,
> -	.remove = bt1_pcie_remove,
> +	.remove_new = bt1_pcie_remove,
>  	.driver = {
>  		.name	= "bt1-pcie",
>  		.of_match_table = bt1_pcie_of_match,

Looking good. Thanks!
Acked-by: Serge Semin <fancer.lancer@xxxxxxxxx>
* For Baikal-T1 PCIe part

-Serge(y)

[nip]

> -- 
> 2.39.2
> 
> 




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux