Re: [PATCH] PCI: shpchp: Remove surplus variable and ineffectual error check

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

 



On Thu, May 21, 2020 at 07:04:57PM +0000, Krzysztof Wilczynski wrote:
> Function remove_board() calls shpchp_unconfigure_device() and checks its
> return code for a possible error which is unnecessary as
> shpchp_unconfigure_device() always returns 0.
> 
> Also, remove surplus variable that has not been used for anything.  This
> will also address the following Coccinelle warning:
> 
>   drivers/pci/hotplug/shpchp_pci.c:66:5-7: Unneeded variable: "rc".
>   Return "0" on line 86
> 
> Signed-off-by: Krzysztof Wilczynski <kw@xxxxxxxxx>

Applied to pci/hotplug for v5.8, thanks!

> ---
>  drivers/pci/hotplug/shpchp.h      | 2 +-
>  drivers/pci/hotplug/shpchp_ctrl.c | 3 +--
>  drivers/pci/hotplug/shpchp_pci.c  | 5 +----
>  3 files changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
> index f7f13ee5d06e..6e85885b554c 100644
> --- a/drivers/pci/hotplug/shpchp.h
> +++ b/drivers/pci/hotplug/shpchp.h
> @@ -164,7 +164,7 @@ u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl);
>  u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl);
>  u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl);
>  int shpchp_configure_device(struct slot *p_slot);
> -int shpchp_unconfigure_device(struct slot *p_slot);
> +void shpchp_unconfigure_device(struct slot *p_slot);
>  void cleanup_slots(struct controller *ctrl);
>  void shpchp_queue_pushbutton_work(struct work_struct *work);
>  int shpc_init(struct controller *ctrl, struct pci_dev *pdev);
> diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
> index 078003dcde5b..afdc52d1cae7 100644
> --- a/drivers/pci/hotplug/shpchp_ctrl.c
> +++ b/drivers/pci/hotplug/shpchp_ctrl.c
> @@ -341,8 +341,7 @@ static int remove_board(struct slot *p_slot)
>  	u8 hp_slot;
>  	int rc;
>  
> -	if (shpchp_unconfigure_device(p_slot))
> -		return(1);
> +	shpchp_unconfigure_device(p_slot);
>  
>  	hp_slot = p_slot->device - ctrl->slot_device_offset;
>  	p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
> diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c
> index 115701301487..36db0c3c4ea6 100644
> --- a/drivers/pci/hotplug/shpchp_pci.c
> +++ b/drivers/pci/hotplug/shpchp_pci.c
> @@ -61,9 +61,8 @@ int shpchp_configure_device(struct slot *p_slot)
>  	return ret;
>  }
>  
> -int shpchp_unconfigure_device(struct slot *p_slot)
> +void shpchp_unconfigure_device(struct slot *p_slot)
>  {
> -	int rc = 0;
>  	struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
>  	struct pci_dev *dev, *temp;
>  	struct controller *ctrl = p_slot->ctrl;
> @@ -83,6 +82,4 @@ int shpchp_unconfigure_device(struct slot *p_slot)
>  	}
>  
>  	pci_unlock_rescan_remove();
> -	return rc;
>  }
> -
> -- 
> 2.26.2
> 



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux