Re: [PATCH 02/10] firewire-net: Rename a jump label in fwnet_broadcast_start()
On Sep 18 SF Markus Elfring wrote: > Adjust jump labels according to the current Linux coding style > convention. The current CodingStyle says: "Choose label names which say what the goto does or why the goto exists." Given the choice between /what/ and /why/, I for one lean towards /why/. In this instance, the what and why is "clean up and exit after an error occurred". 'failed' looks to me to be a better shorthand of this than 'stop_broadcast'. The latter merely says /how/ the cleanup is done. > Signed-off-by: Markus Elfring> --- > drivers/firewire/net.c | 13 ++--- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c > index 7911f13..89afed3 100644 > --- a/drivers/firewire/net.c > +++ b/drivers/firewire/net.c > @@ -1106,7 +1106,7 @@ static int fwnet_broadcast_start(struct > fwnet_device *dev) ptrptr = kmalloc_array(num_packets, sizeof(*ptrptr), > GFP_KERNEL); if (!ptrptr) { > retval = -ENOMEM; > - goto failed; > + goto stop_broadcast; > } > dev->broadcast_rcv_buffer_ptrs = ptrptr; > > @@ -1116,13 +1116,13 @@ static int fwnet_broadcast_start(struct > fwnet_device *dev) fwnet_receive_broadcast, dev); > if (IS_ERR(context)) { > retval = PTR_ERR(context); > - goto failed; > + goto stop_broadcast; > } [...] > @@ -1166,8 +1166,7 @@ static int fwnet_broadcast_start(struct > fwnet_device *dev) dev->broadcast_state = FWNET_BROADCAST_RUNNING; > > return 0; > - > - failed: > + stop_broadcast: > __fwnet_broadcast_stop(dev); > return retval; > } I see no reason to remove the blank line between the return statement and the label. -- Stefan Richter -==- =--= ==--- http://arcgraph.de/sr/
Re: [PATCH 02/10] firewire-net: Rename a jump label in fwnet_broadcast_start()
On Sep 18 SF Markus Elfring wrote: > Adjust jump labels according to the current Linux coding style > convention. The current CodingStyle says: "Choose label names which say what the goto does or why the goto exists." Given the choice between /what/ and /why/, I for one lean towards /why/. In this instance, the what and why is "clean up and exit after an error occurred". 'failed' looks to me to be a better shorthand of this than 'stop_broadcast'. The latter merely says /how/ the cleanup is done. > Signed-off-by: Markus Elfring > --- > drivers/firewire/net.c | 13 ++--- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c > index 7911f13..89afed3 100644 > --- a/drivers/firewire/net.c > +++ b/drivers/firewire/net.c > @@ -1106,7 +1106,7 @@ static int fwnet_broadcast_start(struct > fwnet_device *dev) ptrptr = kmalloc_array(num_packets, sizeof(*ptrptr), > GFP_KERNEL); if (!ptrptr) { > retval = -ENOMEM; > - goto failed; > + goto stop_broadcast; > } > dev->broadcast_rcv_buffer_ptrs = ptrptr; > > @@ -1116,13 +1116,13 @@ static int fwnet_broadcast_start(struct > fwnet_device *dev) fwnet_receive_broadcast, dev); > if (IS_ERR(context)) { > retval = PTR_ERR(context); > - goto failed; > + goto stop_broadcast; > } [...] > @@ -1166,8 +1166,7 @@ static int fwnet_broadcast_start(struct > fwnet_device *dev) dev->broadcast_state = FWNET_BROADCAST_RUNNING; > > return 0; > - > - failed: > + stop_broadcast: > __fwnet_broadcast_stop(dev); > return retval; > } I see no reason to remove the blank line between the return statement and the label. -- Stefan Richter -==- =--= ==--- http://arcgraph.de/sr/
[PATCH 02/10] firewire-net: Rename a jump label in fwnet_broadcast_start()
From: Markus ElfringDate: Sat, 17 Sep 2016 22:02:44 +0200 Adjust jump labels according to the current Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/firewire/net.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 7911f13..89afed3 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c @@ -1106,7 +1106,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) ptrptr = kmalloc_array(num_packets, sizeof(*ptrptr), GFP_KERNEL); if (!ptrptr) { retval = -ENOMEM; - goto failed; + goto stop_broadcast; } dev->broadcast_rcv_buffer_ptrs = ptrptr; @@ -1116,13 +1116,13 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) fwnet_receive_broadcast, dev); if (IS_ERR(context)) { retval = PTR_ERR(context); - goto failed; + goto stop_broadcast; } retval = fw_iso_buffer_init(>broadcast_rcv_buffer, dev->card, FWNET_ISO_PAGE_COUNT, DMA_FROM_DEVICE); if (retval < 0) - goto failed; + goto stop_broadcast; dev->broadcast_state = FWNET_BROADCAST_STOPPED; @@ -1148,7 +1148,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) retval = fw_iso_context_queue(context, , >broadcast_rcv_buffer, offset); if (retval < 0) - goto failed; + goto stop_broadcast; offset += max_receive; } @@ -1158,7 +1158,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) retval = fw_iso_context_start(context, -1, 0, FW_ISO_CONTEXT_MATCH_ALL_TAGS); /* ??? sync */ if (retval < 0) - goto failed; + goto stop_broadcast; /* FIXME: adjust it according to the min. speed of all known peers? */ dev->broadcast_xmt_max_payload = IEEE1394_MAX_PAYLOAD_S100 @@ -1166,8 +1166,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) dev->broadcast_state = FWNET_BROADCAST_RUNNING; return 0; - - failed: + stop_broadcast: __fwnet_broadcast_stop(dev); return retval; } -- 2.10.0
[PATCH 02/10] firewire-net: Rename a jump label in fwnet_broadcast_start()
From: Markus Elfring Date: Sat, 17 Sep 2016 22:02:44 +0200 Adjust jump labels according to the current Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/firewire/net.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 7911f13..89afed3 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c @@ -1106,7 +1106,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) ptrptr = kmalloc_array(num_packets, sizeof(*ptrptr), GFP_KERNEL); if (!ptrptr) { retval = -ENOMEM; - goto failed; + goto stop_broadcast; } dev->broadcast_rcv_buffer_ptrs = ptrptr; @@ -1116,13 +1116,13 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) fwnet_receive_broadcast, dev); if (IS_ERR(context)) { retval = PTR_ERR(context); - goto failed; + goto stop_broadcast; } retval = fw_iso_buffer_init(>broadcast_rcv_buffer, dev->card, FWNET_ISO_PAGE_COUNT, DMA_FROM_DEVICE); if (retval < 0) - goto failed; + goto stop_broadcast; dev->broadcast_state = FWNET_BROADCAST_STOPPED; @@ -1148,7 +1148,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) retval = fw_iso_context_queue(context, , >broadcast_rcv_buffer, offset); if (retval < 0) - goto failed; + goto stop_broadcast; offset += max_receive; } @@ -1158,7 +1158,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) retval = fw_iso_context_start(context, -1, 0, FW_ISO_CONTEXT_MATCH_ALL_TAGS); /* ??? sync */ if (retval < 0) - goto failed; + goto stop_broadcast; /* FIXME: adjust it according to the min. speed of all known peers? */ dev->broadcast_xmt_max_payload = IEEE1394_MAX_PAYLOAD_S100 @@ -1166,8 +1166,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) dev->broadcast_state = FWNET_BROADCAST_RUNNING; return 0; - - failed: + stop_broadcast: __fwnet_broadcast_stop(dev); return retval; } -- 2.10.0