[PATCH 1/4] staging: dgnc: audit goto's in dgnc_driver

Tobin C. Harding me at tobin.cc
Tue Mar 7 09:37:18 UTC 2017


On Tue, Mar 07, 2017 at 10:28:17AM +0100, Greg Kroah-Hartman wrote:
> On Tue, Mar 07, 2017 at 07:57:40PM +1100, Tobin C. Harding wrote:
> > On Tue, Mar 07, 2017 at 09:42:53AM +0100, Greg Kroah-Hartman wrote:
> > > On Tue, Mar 07, 2017 at 05:33:06PM +1100, Tobin C. Harding wrote:
> > > > TODO file requests fix up of error handling.
> > > > 
> > > > Audit dgnc_driver.c and fix all return paths to be uniform and inline
> > > > with kernel coding style.
> > > > 
> > > > Signed-off-by: Tobin C. Harding <me at tobin.cc>
> > > > ---
> > > >  drivers/staging/dgnc/dgnc_driver.c | 27 +++++++--------------------
> > > >  1 file changed, 7 insertions(+), 20 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
> > > > index 5381dbd..8075fff 100644
> > > > --- a/drivers/staging/dgnc/dgnc_driver.c
> > > > +++ b/drivers/staging/dgnc/dgnc_driver.c
> > > > @@ -98,13 +98,11 @@ static const struct board_id dgnc_ids[] = {
> > > >  
> > > >  static int dgnc_do_remap(struct dgnc_board *brd)
> > > >  {
> > > > -	int rc = 0;
> > > > -
> > > >  	brd->re_map_membase = ioremap(brd->membase, 0x1000);
> > > >  	if (!brd->re_map_membase)
> > > > -		rc = -ENOMEM;
> > > > +		return -ENOMEM;
> > > >  
> > > > -	return rc;
> > > > +	return 0;
> > > >  }
> > > >  
> > > >  /*
> > > > @@ -198,7 +196,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
> > > >  		brd->bd_dividend = 921600;
> > > >  
> > > >  		rc = dgnc_do_remap(brd);
> > > > -
> > > >  		if (rc < 0)
> > > >  			goto failed;
> > > >  
> > > > @@ -283,27 +280,23 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
> > > >  
> > > >  failed:
> > > >  	kfree(brd);
> > > > -
> > > >  	return ERR_PTR(rc);
> > > >  }
> > > >  
> > > >  static int dgnc_request_irq(struct dgnc_board *brd)
> > > >  {
> > > > -	int rc = 0;
> > > > -
> > > >  	if (brd->irq) {
> > > > -		rc = request_irq(brd->irq, brd->bd_ops->intr,
> > > > +		int rc = request_irq(brd->irq, brd->bd_ops->intr,
> > > >  				 IRQF_SHARED, "DGNC", brd);
> > > > -
> > > >  		if (rc) {
> > > > -			dev_err(&brd->pdev->dev,
> > > > -				"Failed to hook IRQ %d\n", brd->irq);
> > > > +			dev_err(&brd->pdev->dev, "Failed to hook IRQ %d\n",
> > > > +				brd->irq);
> > > 
> > > Why change these two lines?
> > 
> > change based on information in Documentation/process/coding-style.rst
> > 
> > ...Descendants are always substantially shorter than the parent and
> > are placed substantially to the right...
> > 
> > Is my interpretation wrong? I read that as meaning the amendment in question
> > was preferable to the original?
> > 
> > Or is it a case that neither way is definitively better so better not
> > to touch it? 
> 
> It's fine to change it, as it is something that could be done, BUT not
> as part of a patch that is doing something totally different, right?
> 
> Remember, only one thing at a time please.

Oh, of course. Too trigger happy. thanks for pointing it out. Will re-submit.

thanks,
Tobin.


More information about the devel mailing list