Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751085AbdFTPqq (ORCPT ); Tue, 20 Jun 2017 11:46:46 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:25750 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750859AbdFTPqp (ORCPT ); Tue, 20 Jun 2017 11:46:45 -0400 Subject: Re: [PATCH v4 08/18] xen/pvcalls: implement connect command To: Stefano Stabellini , xen-devel@lists.xen.org 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> Cc: linux-kernel@vger.kernel.org, jgross@suse.com, Stefano Stabellini From: Boris Ostrovsky Message-ID: Date: Tue, 20 Jun 2017 11:47:34 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <85f49d02-a640-6259-727d-e3761631d1b5@oracle.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1193 Lines: 51 >> + >> 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(). -boris > >> + } >> + >> +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; >