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

2015-05-28 Thread insop.s...@gainspeed.com
On Thu, May 28, 2015 at 01:08:36PM +0300, Dan Carpenter wrote:
> On Thu, May 28, 2015 at 09:38:23AM +, Gujulan Elango, Hari Prasath (H.) 
> wrote:
> > remove redundant code in this function by introducing a new retval
> > variable.
> > 
> > Signed-off-by: Gujulan Elango Hari Prasath 
> 
> No the original code is quite bad but this patch makes it worse.

Please elaborate what was 'quite bad' in the original code?

Regards,
ISS

> 
> gs_release_image() can't fail, and it should be a void function.
> 
> > ---
> >  drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 18 --
> >  1 file changed, 8 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c 
> > b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
> > index a3a10f9..cc0445c 100644
> > --- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
> > +++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
> > @@ -290,6 +290,7 @@ static int gs_fpgaboot(void)
> >  {
> > int err;
> > struct fpgaimage*fimage;
> > +   int retval = 0;
> >  
> > fimage = kmalloc(sizeof(struct fpgaimage), GFP_KERNEL);
> > if (!fimage)
> > @@ -298,44 +299,41 @@ static int gs_fpgaboot(void)
> > err = gs_load_image(fimage, file);
> > if (err) {
> 
>   goto free_fimage;
> 
> > pr_err("gs_load_image error\n");
> > +   retval = -1;
> > goto err_out1;
> > }
> >  
> > err = gs_read_image(fimage);
> > if (err) {
> 
> 
>   goto release_image;
> 
> > pr_err("gs_read_image error\n");
> > +   retval = -1;
> > goto err_out2;
> > }
> >  
> > err = gs_set_download_method(fimage);
> > if (err) {
> 
>   goto release_image;
> 
> > pr_err("gs_set_download_method error\n");
> > +   retval = -1;
> > goto err_out2;
> > }
> >  
> > err = gs_download_image(fimage, bus_2byte);
> 
> 
> release_image:
>   gs_release_image(fimage);
> free_fimage:
>   kfree(fimage);
> 
>   return err;
> 
> regards,
> dan carpenter
___
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2015-05-28 Thread insop.s...@gainspeed.com
On Thu, May 28, 2015 at 09:50:23PM +0300, Dan Carpenter wrote:
> On Thu, May 28, 2015 at 09:39:14AM -0700, [email protected] wrote:
> > On Thu, May 28, 2015 at 01:08:36PM +0300, Dan Carpenter wrote:
> > > On Thu, May 28, 2015 at 09:38:23AM +, Gujulan Elango, Hari Prasath 
> > > (H.) wrote:
> > > > remove redundant code in this function by introducing a new retval
> > > > variable.
> > > > 
> > > > Signed-off-by: Gujulan Elango Hari Prasath 
> > > 
> > > No the original code is quite bad but this patch makes it worse.
> > 
> > Please elaborate what was 'quite bad' in the original code?
> 
> GW-BASIC labels.
what do you mean?

> return -1 instead of proper error codes.
Okay,

> poorly thought out error messages.
which one are you exactly refering?
I went through all error messages, but cannot find which one(s) you exactly 
mean.

> The error handling of gs_release_image() was silly.
I would say, ""The error handling of gs_release_image() was "unnecessary"""
instead.

So your feedback is mostly on error code and error messages
Thank you for your feedback.

Regards,

ISS
___
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2015-05-29 Thread insop.s...@gainspeed.com
On Thu, May 28, 2015 at 03:43:42PM +0300, Dan Carpenter wrote:
> On Thu, May 28, 2015 at 12:08:56PM +, 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 
> 
> Looks good.  Thanks!
> 
> regards,
> dan carpenter
> 

Reviewed-by: Insop Song 

Looks good to me.
Thank you.

ISS
___
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel