Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932679AbbKCUyq (ORCPT ); Tue, 3 Nov 2015 15:54:46 -0500 Received: from mout.web.de ([212.227.17.12]:55769 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932576AbbKCUyo (ORCPT ); Tue, 3 Nov 2015 15:54:44 -0500 Subject: [PATCH 2/3] batman-adv: Split a condition check To: Antonio Quartulli , "David S. Miller" , Marek Lindner , Simon Wunderlich , b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <56391CF7.9080400@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <56391F0B.2060102@users.sourceforge.net> Date: Tue, 3 Nov 2015 21:54:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <56391CF7.9080400@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:HGkWViAh6Sl3ru/S6iA0KattZbq3z52o0qqIW79KrXY9xMJ2qEt 3DqmNqZClWaWQZ1EfQRsSsV5zKWd/IP40RFNa+AwzZtTvIg5OfOR+zCyuWX9oZuquVihVrf kLJ5glZ+Hs1BcWDzQrdg7Ihays+bv0zmdtEEWsy5tfNzytxrOKSHx5UnDihHqQakEQ35Bu0 5zdqZiSIrqchRWV8vFQvg== X-UI-Out-Filterresults: notjunk:1;V01:K0:flWURpKJY5U=:9fn8aBiAUQ5xT8G/Vdsl4Q ChSufZ5Wo1jJzP0A1vs0xkaTf+QR0wzeZ1IkRue99IRA2v/ylZ6F2C3PjNC1AXsCcAVkII9vO YcP0bHIUYRD7g07GuhaYLO0GhSzDj0rxDE210Wh836QA4nfemjRO4knae8rdpbtlMTxpAA5El O7juQD8D0vted2pPaB692oWRrWZwdbwPBCCAJIITGhuDA5eBFRcb33QmLkGxpgmeys62mLMlr ZM73oLwnCV2z1Oxw5Hg5oylnYr6XNN25jOWJGKQbLfbrOYf6w7USeUX1SMtFUc8BNthZTDIpx U+E0qeUBEI59UGe+GA4/QVripAhW0N79e6tJs94GUDkpw6y9X9JAsVmJcmQPQ/2HSrm8OOxBt Y/eFWvaUk3GiM3etU733Nx+1KSOdDnsv8g/ncLnxYnXaJ0LofAnTEquufwS7JhtDQUDOsQuZ9 5r6TvbAbr2qHq8Z4/f1Bsdf/k7jqhQuoZakLkM8dUR/7r0QJ9nBwpekI7/+P2e16Mn9QsNXCJ kliZf9dALGASwxbiqhCiVz6lCiezWpjdXMNuoZ8qgjhQpsQSZ8lWXQvLe4qG0Jew1KOofCe8y yTY2RywkbpIHg0RrU/Svs8rKzK7+vkOhZ+IxL4NkVdbWM2TQWeZOMVxk3UaRvVlvJ77pTtxtj PHU/AyAvWZFg/2iab791lVUh7fszuRd6aIT0fc1KB8NUoBKDSOnt5M+HB1XlLVa7/nCM1ZEJy 0khlUQLLezyNxSzuM+94U9UXcRtJj2xmr8FqiInsTgAmKJPHuP+I0kVQ2RRVziSCJnvR4Xwnk 6XhArwR Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1279 Lines: 36 From: Markus Elfring Date: Tue, 3 Nov 2015 20:41:02 +0100 Let us split a check for a condition at the beginning of the batadv_is_ap_isolated() function so that a direct return can be performed in this function if the variable "vlan" contained a null pointer. Signed-off-by: Markus Elfring --- net/batman-adv/translation-table.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 48315de..965a004 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -3319,7 +3319,10 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, bool ret = false; vlan = batadv_softif_vlan_get(bat_priv, vid); - if (!vlan || !atomic_read(&vlan->ap_isolation)) + if (!vlan) + return false; + + if (!atomic_read(&vlan->ap_isolation)) goto out; tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid); -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/