From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guillaume Nault Date: Tue, 05 Apr 2016 21:22:22 +0000 Subject: Re: [RFC PATCH 6/6] ppp: add rtnetlink device creation support Message-Id: <20160405212222.GD1305@alphalink.fr> List-Id: References: <5703F356.6050107@bfs.de> In-Reply-To: <5703F356.6050107@bfs.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: walter harms Cc: netdev@vger.kernel.org, linux-ppp@vger.kernel.org, Paul Mackerras , David Miller On Tue, Apr 05, 2016 at 07:18:14PM +0200, walter harms wrote: > > > Am 05.04.2016 02:56, schrieb Guillaume Nault: > > @@ -1043,12 +1048,39 @@ static int ppp_dev_configure(struct net *src_net, struct net_device *dev, > > const struct ppp_config *conf) > > { > > struct ppp *ppp = netdev_priv(dev); > > + struct file *file; > > int indx; > > + int err; > > + > > + if (conf->fd < 0) { > > + file = conf->file; > > + if (!file) { > > + err = -EBADF; > > + goto out; > > why not just return -EBADF; > > > + } > > + } else { > > + file = fget(conf->fd); > > + if (!file) { > > + err = -EBADF; > > + goto out; > > why not just return -EBADF; > Just because the 'out' label is declared anyway and because this centralises the return point. But I agree returning -EBADF directly could be more readable. I don't have strong opinion. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guillaume Nault Subject: Re: [RFC PATCH 6/6] ppp: add rtnetlink device creation support Date: Tue, 5 Apr 2016 23:22:22 +0200 Message-ID: <20160405212222.GD1305@alphalink.fr> References: <5703F356.6050107@bfs.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, linux-ppp@vger.kernel.org, Paul Mackerras , David Miller To: walter harms Return-path: Content-Disposition: inline In-Reply-To: <5703F356.6050107@bfs.de> Sender: linux-ppp-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Tue, Apr 05, 2016 at 07:18:14PM +0200, walter harms wrote: > > > Am 05.04.2016 02:56, schrieb Guillaume Nault: > > @@ -1043,12 +1048,39 @@ static int ppp_dev_configure(struct net *src_net, struct net_device *dev, > > const struct ppp_config *conf) > > { > > struct ppp *ppp = netdev_priv(dev); > > + struct file *file; > > int indx; > > + int err; > > + > > + if (conf->fd < 0) { > > + file = conf->file; > > + if (!file) { > > + err = -EBADF; > > + goto out; > > why not just return -EBADF; > > > + } > > + } else { > > + file = fget(conf->fd); > > + if (!file) { > > + err = -EBADF; > > + goto out; > > why not just return -EBADF; > Just because the 'out' label is declared anyway and because this centralises the return point. But I agree returning -EBADF directly could be more readable. I don't have strong opinion.