Re: [PATCH] staging: ft1000: cleanup ft1000_usb.c

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

 



On Mon, Sep 27, 2010 at 03:21:42PM +0200, Belisko Marek wrote:
> remove unused comments, check for memory leaks, add header.

This should be 3 different patches, care to split it up?

Remember, a patch should only do one thing at a time.

> --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
> +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
> @@ -1,33 +1,36 @@
> -//=====================================================
> -// CopyRight (C) 2007 Qualcomm Inc. All Rights Reserved.
> -//
> -//
> -// This file is part of Express Card USB Driver
> -//
> -// $Id:
> -//====================================================
> -// 20090926; aelias; removed all compiler warnings; ubuntu 9.04;
> 2.6.28-15-generic
> +/*
> + *  Express Card USB driver (ft1000)
> + *
> + *  Copyright (C) 2007 Qualcomm Inc. All Rights Reserved.
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation; either version 2 of the License, or
> + *  (at your option) any later version.

Are you sure you really mean "any later version"?  Is that what the
copyright holder wants?

> + *
> + *  This program is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *  GNU General Public License for more details.
> + *
> + *  You should have received a copy of the GNU General Public License
> + *  along with this program; if not, write to the Free Software
> + *  Foundation, Inc.,
> + *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

These two paragraphs are not needed at all.


> + *
> + *
> + */
>  #include <linux/init.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/usb.h>
>  #include <linux/netdevice.h>
>  #include <linux/etherdevice.h>
> -#include "ft1000_usb.h"
> -
> -//#include <linux/sched.h>
> -//#include <linux/ptrace.h>
> -//#include <linux/slab.h>
> -//#include <linux/string.h>
> -//#include <linux/timer.h>
> -//#include <linux/netdevice.h>
> -//#include <linux/ioport.h>
> -//#include <linux/delay.h>
> -//#include <asm/io.h>
> -//#include <asm/system.h>
>  #include <linux/kthread.h>
>  #include <linux/firmware.h>
> 
> +#include "ft1000_usb.h"
> +
>  MODULE_DESCRIPTION("FT1000 EXPRESS CARD DRIVER");
>  MODULE_LICENSE("Dual MPL/GPL");
>  MODULE_SUPPORTED_DEVICE("QFT FT1000 Express Cards");
> @@ -80,22 +83,9 @@ int ft1000_poll_thread(void *arg)
>  			}
>  		}
>  	}
> -	//DEBUG("returned from polling thread\n");
>  	return STATUS_SUCCESS;
>  }
> 
> -//---------------------------------------------------------------------------
> -// Function:    ft1000_probe
> -//
> -// Parameters:  struct usb_interface *interface  - passed by USB core
> -//              struct usb_device_id *id         - passed by USB core
> -// Returns:     0 - success
> -//
> -// Description: This function is invoked when the express card is plugged in
> -//
> -// Notes:
> -//
> -//---------------------------------------------------------------------------
>  static int ft1000_probe(struct usb_interface *interface,
>  			const struct usb_device_id *id)
>  {
> @@ -117,7 +107,6 @@ static int ft1000_probe(struct usb_interface *interface,
> 
>  	memset(ft1000dev, 0, sizeof(*ft1000dev));
> 
> -	//get usb device
>  	dev = interface_to_usbdev(interface);
>  	DEBUG("ft1000_probe: usb device descriptor info:\n");
>  	DEBUG("ft1000_probe: number of configuration is %d\n",
> @@ -184,7 +173,7 @@ static int ft1000_probe(struct usb_interface *interface,
>  	ret = request_firmware(&dsp_fw, "ft3000.img", &dev->dev);
>  	if (ret < 0) {
>  		printk("Error reading firmware. ret:%d\n", ret);	
> -		return -ENOMEM;
> +		return -EIO;
>  	}	
>  	
>  	size = max_t(uint, dsp_fw->size, 4096);
> @@ -192,31 +181,28 @@ static int ft1000_probe(struct usb_interface *interface,
>  	
>  	if (!pFileStart) {
>  		release_firmware(dsp_fw);
> -		return -ENOMEM;
> +		goto err_mem;
>  	}
> 
>  	memcpy(pFileStart, dsp_fw->data, dsp_fw->size);
>  	FileLength = dsp_fw->size;
>  	release_firmware(dsp_fw);
> 
> -	//download dsp image
>  	DEBUG("ft1000_probe: start downloading dsp image...\n");
>  	init_ft1000_netdev(ft1000dev);
>  	pft1000info = (FT1000_INFO *) netdev_priv(ft1000dev->net);
> 
> -//    DEBUG("In probe: pft1000info=%x\n", pft1000info);
>           // aelias [-] reason: warning: format ???%x??? expects type
> ???unsigned int???, but argument 2 has type ???struct FT1000_INFO *???
> -	DEBUG("In probe: pft1000info=%x\n", (unsigned int)pft1000info);	//
> aelias [+] reason: up
> +	DEBUG("In probe: pft1000info=%x\n", (unsigned int)pft1000info);	
> 
>  	dsp_reload(ft1000dev);
> -	gPollingfailed = FALSE;	//mbelian
> +	gPollingfailed = FALSE;	

Don't add trailing whitespace to the file, please run the checkpatch.pl
script on your patches, which will catch this.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/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