From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> 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. Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- arch/um/drivers/port_user.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c index 9a8e1b64c22e..8d95fa5641af 100644 --- a/arch/um/drivers/port_user.c +++ b/arch/um/drivers/port_user.c @@ -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; -- 2.14.2 -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html