Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752094AbdFUU03 (ORCPT ); Wed, 21 Jun 2017 16:26:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:32842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751963AbdFUU02 (ORCPT ); Wed, 21 Jun 2017 16:26:28 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5632B2187C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=sstabellini@kernel.org Date: Wed, 21 Jun 2017 13:26:23 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-X260 To: Boris Ostrovsky cc: Stefano Stabellini , xen-devel@lists.xen.org, linux-kernel@vger.kernel.org, jgross@suse.com, Stefano Stabellini Subject: Re: [PATCH v4 08/18] xen/pvcalls: implement connect command In-Reply-To: Message-ID: References: <1497553787-3709-1-git-send-email-sstabellini@kernel.org> <1497553787-3709-8-git-send-email-sstabellini@kernel.org> <85f49d02-a640-6259-727d-e3761631d1b5@oracle.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1338 Lines: 51 On Tue, 20 Jun 2017, Boris Ostrovsky wrote: > >> + > >> static int pvcalls_back_connect(struct xenbus_device *dev, > >> struct xen_pvcalls_request *req) > >> { > >> + struct pvcalls_fedata *fedata; > >> + int ret = -EINVAL; > >> + struct socket *sock; > >> + struct sock_mapping *map; > >> + struct xen_pvcalls_response *rsp; > >> + > >> + fedata = dev_get_drvdata(&dev->dev); > >> + > >> + ret = sock_create(AF_INET, SOCK_STREAM, 0, &sock); > >> + if (ret < 0) > >> + goto out; > >> + ret = inet_stream_connect(sock, (struct sockaddr *)&req->u.connect.addr, > >> + req->u.connect.len, req->u.connect.flags); > >> + if (ret < 0) { > >> + sock_release(sock); > >> + goto out; > >> + } > >> + > >> + map = pvcalls_new_active_socket(fedata, > >> + req->u.connect.id, > >> + req->u.connect.ref, > >> + req->u.connect.evtchn, > >> + sock); > >> + if (!map) { > >> + sock_release(map->sock); > >> + goto out; > > Unnecessary goto. > > Oh, and also ret needs to be set since it will be cleared by > inet_stream_connect(). Right, thanks! > > > >> + } > >> + > >> +out: > >> + rsp = RING_GET_RESPONSE(&fedata->ring, fedata->ring.rsp_prod_pvt++); > >> + rsp->req_id = req->req_id; > >> + rsp->cmd = req->cmd; > >> + rsp->u.connect.id = req->u.connect.id; > >> + rsp->ret = ret; > >> + > >> + return ret; > > >