Skip to contentSkip to conversation

um: Use common error handling code in port_listen_fd()

PATCH In review SF Markus Elfring 4 participants 9 messages Oct 20, 2017 – Oct 23, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 um: Use common error handling code in port_listen_fd()

From: Markus Elfring <[email protected]>
Date: Fri, 20 Oct 2017 19:24:39 +0200

Add a jump target so that a bit of exception handling can be better reused at the end of this function.

This issue was detected by using the Coccinelle software.

---
 arch/um/drivers/port_user.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
arch/um/drivers/port_user.c +8 -13
index 9a8e1b64c22e..8d95fa5641af 100644
@@ -118,29 +118,24 @@ int port_listen_fd(int port)
 		return -errno;
 
 	arg = 1;
-	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0) {
-		err = -errno;
-		goto out;
-	}
+	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0)
+		goto failure_indication;
 
 	addr.sin_family = AF_INET;
 	addr.sin_port = htons(port);
 	addr.sin_addr.s_addr = htonl(INADDR_ANY);
-	if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
-		err = -errno;
-		goto out;
-	}
-
-	if (listen(fd, 1) < 0) {
-		err = -errno;
-		goto out;
-	}
+	if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0 ||
+	    listen(fd, 1) < 0)
+		goto failure_indication;
 
 	err = os_set_fd_block(fd, 0);
 	if (err < 0)
 		goto out;
 
 	return fd;
+
+ failure_indication:
+	err = -errno;
  out:
 	close(fd);
 	return err;
Signature · 1 line
2.14.2
#1 lore raw
Quoted 1 line · SF Markus Elfring

arch/um/drivers/port_user.c

If you are going to use multiple labels,
it'd be nicer to rename out: too.

#2 lore raw
Quoted 2 lines

If you are going to use multiple labels,
it'd be nicer to rename out: too.

Thanks for your suggestion.

I left this place untouched because such kind of renaming seemed to be unwanted in some software areas for a while.
How long should I wait for corresponding feedback before another small source code adjustment will be appropriate?

Regards,
Markus

#3 lore raw
In reply to SF Markus Elfring

This business of moving the error code to the bottom of the function just makes the code less readable. I know you never listen to anyone, but you should stop doing it.

regards,
dan carpenter

#4 lore raw
Quoted 2 lines

This business of moving the error code to the bottom of the function just makes the code less readable.

I got an other software development opinion on this aspect. Could you become used to the proposed control flow structure in the affected function?

Quoted 1 line

I know you never listen to anyone,

My response times might not fir to your preferences.

Quoted 1 line

but you should stop doing it.

I am going to offer suggestions for change patterns which I find useful. There are some challenges around change acceptance as usual.

Regards,
Markus

#5 lore raw
Quoted 7 lines · SF Markus Elfring
Quoted 2 lines

This business of moving the error code to the bottom of the function just makes the code less readable.

I got an other software development opinion on this aspect. Could you become used to the proposed control flow structure in the affected function?

No. Don't do this. It's pointless obfuscation.

Quoted 10 lines
Quoted 2 lines

I know you never listen to anyone,

My response times might not fir to your preferences.

Quoted 1 line

but you should stop doing it.

I am going to offer suggestions for change patterns which I find useful. There are some challenges around change acceptance as usual.

Yeah. I knew it was pointless to ask you to stop this... :(

regards,
dan carpenter

#6 lore raw
Quoted 5 lines
Quoted 3 lines

Could you become used to the proposed control flow structure in the affected function?

No. Don't do this.

Thanks for your information.

Quoted 1 line

It's pointless obfuscation.

I disagree for this view.

Quoted 3 lines
Quoted 1 line

There are some challenges around change acceptance as usual.

Yeah. I knew it was pointless to ask you to stop this... :(

The mixture of agreements and disagreements will evolve over time, won't they?

Regards,
Markus

#7 lore raw
In reply to Dan Carpenter
Quoted 3 lines · Dan Carpenter

This business of moving the error code to the bottom of the function just makes the code less readable. I know you never listen to anyone, but you should stop doing it.

How long have we to put up with this?
He just keeps sending these crap patches without listening to anybody, thereby wasting valuable developer time.

Even browsing LKML is no fun anymore, because his endless mindless patch series drags everything down qualitywise.

David, would it be possible to simply ban him (SF Markus Elfring) from vger.kernel.org?

Signature · 1 line
Markus
#8 lore raw
Quoted 1 line

He just keeps sending these crap patches without listening to anybody,

I am listening. - But this does not automatically mean that we come to the same thoughts and conclusions on some topics.

Quoted 1 line

thereby wasting valuable developer time.

There are also contributors who respond in a positive way (while you might not like a specific change so far).

Quoted 1 line

Even browsing LKML is no fun anymore,

It can be very challenging as the communication traffic is evolving.

Quoted 1 line

because his endless mindless patch series drags everything down qualitywise.

This is a pity that you interpret my different contributions into such a direction.

Quoted 2 lines

David, would it be possible to simply ban him (SF Markus Elfring) from vger.kernel.org?

Do you really prefer censorship over free speech in this case?

Regards,
Markus