Re: [PATCH 1/2] staging: dgap: cleanup driver module exit and remove function

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

 



On Tue, Jun 09, 2015 at 05:26:01PM +0000, Gujulan Elango, Hari Prasath (H.) wrote:
> From: Hari Prasath Gujulan Elango <hgujulan@xxxxxxxxxxx>
> 
> The driver remove function is not the right place to cleanup resources
> allocated in the driver module init.The cleanup is moved from remove
> function to module exit as appropriate.
> 
> Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@xxxxxxxxxxx>
> ---
>  drivers/staging/dgap/dgap.c | 17 ++---------------
>  1 file changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
> index 26b0446..185e9e5 100644
> --- a/drivers/staging/dgap/dgap.c
> +++ b/drivers/staging/dgap/dgap.c
> @@ -7007,21 +7007,6 @@ static void dgap_cleanup_board(struct board_t *brd)
>  static void dgap_remove_one(struct pci_dev *dev)
>  {
>  	unsigned int i;
> -	ulong lock_flags;
> -	struct pci_driver *drv = to_pci_driver(dev->dev.driver);
> -
> -	spin_lock_irqsave(&dgap_poll_lock, lock_flags);
> -	dgap_poll_stop = 1;
> -	spin_unlock_irqrestore(&dgap_poll_lock, lock_flags);
> -
> -	/* Turn off poller right away. */
> -	del_timer_sync(&dgap_poll_timer);
> -
> -	dgap_remove_driver_sysfiles(drv);
> -
> -	device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0));
> -	class_destroy(dgap_class);
> -	unregister_chrdev(DIGI_DGAP_MAJOR, "dgap");
>  
>  	for (i = 0; i < dgap_numboards; ++i) {
>  		dgap_remove_ports_sysfiles(dgap_board[i]);
> @@ -7159,8 +7144,10 @@ err_stop:
>   */
>  static void dgap_cleanup_module(void)
>  {
> +	dgap_remove_driver_sysfiles(&dgap_driver);
>  	if (dgap_numboards)
>  		pci_unregister_driver(&dgap_driver);

Making this conditional is a bug.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux