Re: [PATCHv2] staging: gs_fpgaboot: remove redundant code

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

 



On Thu, May 28, 2015 at 02:07:36PM +0300, Dan Carpenter wrote:
> On Thu, May 28, 2015 at 10:51:38AM +0000, Gujulan Elango, Hari Prasath (H.) wrote:
> > remove redundant code in this function.remove return value check for
> > function that always return success.
> > 
> > Signed-off-by: Gujulan Elango Hari Prasath <hgujulan@xxxxxxxxxxx>
> > ---
> > 	v2:address review comments from Dan.Remove return value check
> > for the function gs_release_image as it always returns success and
> > rearrange the code accordingly.Also delete debug messages.
> > ---
> >  drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 44 ++++++++-----------------------
> >  1 file changed, 11 insertions(+), 33 deletions(-)
> > 
> > diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
> > index a3a10f9..a792c1a 100644
> > --- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
> > +++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
> > @@ -288,7 +288,7 @@ static void finish_driver(void)
> >  
> >  static int gs_fpgaboot(void)
> >  {
> > -	int err;
> > +	int err = 0;
> 
> Don't do this.  It's just turns off GCC's warning about uninitialized
> variables.
> 
> regards,
> dan carpenter
> 

The reason i did that was if the function doesn't hit any error
condition, then it needs to return 0. If the err variable is not
initialized to 0,I assume that it can take any value.Please correct me
if i am wrong. I removed the retval variable and just used the 'err'
variable itself.
_______________________________________________
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