[PATCH v2 2/7] staging: qlge: Remove gotos from ql_set_mac_addr_reg

Dan Carpenter dan.carpenter at oracle.com
Thu Apr 30 10:08:28 UTC 2020


On Thu, Apr 30, 2020 at 03:03:07AM -0700, Joe Perches wrote:
> On Thu, 2020-04-30 at 12:38 +0300, Dan Carpenter wrote:
> > On Wed, Apr 29, 2020 at 09:33:04PM -0400, Rylan Dmello wrote:
> > > As suggested by Joe Perches, this patch removes the 'exit' label
> > > from the ql_set_mac_addr_reg function and replaces the goto
> > > statements with break statements.
> []
> > > diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> []
> > > @@ -336,22 +336,20 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type,
> > >  
> > >  		status = ql_wait_reg_rdy(qdev, MAC_ADDR_IDX, MAC_ADDR_MW, 0);
> > >  		if (status)
> > > -			goto exit;
> > > +			break;
> > 
> > Just "return status".  A direct return is immediately clear but with a
> > break statement then you have to look down a bit and then scroll back.
> 
> To me, 6 of 1, half dozen of other as
> all the case breaks could be returns.
> 
> So either form is fine with me.
> 
> The old form was poor through.

With a goto exit or a break you have to scroll down to exactly the same
place.  There is no difference at all.

Anyway, I'm actually fine with this patch series as-is.  It improves
a whole lot of stuff and doesn't cause any problems which weren't
there to begin with.

Reviewed-by: Dan Carpenter <dan.carpenter at oracle.com>

regards,
dan carpenter


More information about the devel mailing list