From patchwork Sat Dec 13 19:17:43 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 13833 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 160E4DDFC4 for ; Sun, 14 Dec 2008 06:18:15 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751190AbYLMTSB (ORCPT ); Sat, 13 Dec 2008 14:18:01 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751277AbYLMTRz (ORCPT ); Sat, 13 Dec 2008 14:17:55 -0500 Received: from courier.cs.helsinki.fi ([128.214.9.1]:55749 "EHLO mail.cs.helsinki.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751075AbYLMTRy (ORCPT ); Sat, 13 Dec 2008 14:17:54 -0500 Received: from wrl-59.cs.helsinki.fi (wrl-59.cs.helsinki.fi [128.214.166.179]) (AUTH: PLAIN cs-relay, TLS: TLSv1/SSLv3,256bits,AES256-SHA) by mail.cs.helsinki.fi with esmtp; Sat, 13 Dec 2008 21:17:52 +0200 id 0008C26C.49440A60.0000433B Received: by wrl-59.cs.helsinki.fi (Postfix, from userid 50795) id C18F6A00A4; Sat, 13 Dec 2008 21:17:51 +0200 (EET) From: "=?ISO-8859-1?Q?Ilpo_J=E4rvinen?=" To: David Miller Cc: netdev@vger.kernel.org Subject: [PATCH 03/11] ipv6/mcast: join error paths using goto Date: Sat, 13 Dec 2008 21:17:43 +0200 Message-Id: <12291958711225-git-send-email-ilpo.jarvinen@helsinki.fi> X-Mailer: git-send-email 1.5.2.2 In-Reply-To: <12291958711089-git-send-email-ilpo.jarvinen@helsinki.fi> References: <12291958711278-git-send-email-ilpo.jarvinen@helsinki.fi> <1229195871718-git-send-email-ilpo.jarvinen@helsinki.fi> <12291958711089-git-send-email-ilpo.jarvinen@helsinki.fi> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Ilpo Järvinen --- net/ipv6/mcast.c | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-) diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 0f38960..a51fb33 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -303,20 +303,23 @@ static struct inet6_dev *ip6_mc_find_dev(struct net *net, dev = dev_get_by_index(net, ifindex); if (!dev) - return NULL; + goto nodev; idev = in6_dev_get(dev); - if (!idev) { - dev_put(dev); - return NULL; - } + if (!idev) + goto release; read_lock_bh(&idev->lock); - if (idev->dead) { - read_unlock_bh(&idev->lock); - in6_dev_put(idev); - dev_put(dev); - return NULL; - } + if (idev->dead) + goto unlock_release; + return idev; + +unlock_release: + read_unlock_bh(&idev->lock); + in6_dev_put(idev); +release: + dev_put(dev); +nodev: + return NULL; } void ipv6_sock_mc_close(struct sock *sk)