Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932693AbbKCU4b (ORCPT ); Tue, 3 Nov 2015 15:56:31 -0500 Received: from mout.web.de ([212.227.17.12]:61281 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753672AbbKCU43 (ORCPT ); Tue, 3 Nov 2015 15:56:29 -0500 Subject: [PATCH 3/3] batman-adv: Less function calls in batadv_is_ap_isolated() after error detection 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: <56391F73.7090605@users.sourceforge.net> Date: Tue, 3 Nov 2015 21:56:19 +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:13/TSE5gi2Lcv19sj2d+RtHeCmgw3BElWxdBX29qw2RIV8oQMvz c1FsDkQF6uJa4CZMc5Zr3fngRhamV+asj34uAlJWaf1/ASsHAZKNzSKl4jnVrYNC7O5nM82 ezevHeS3/s2lfOR9QGMSYp5nhF+I/aJPSYYr4dZYrJPhGZ39eEnBHXnYAsLM2+p32Ooq9pV hRanrIZK/AINNCz62Eaww== X-UI-Out-Filterresults: notjunk:1;V01:K0:KDSTUo3Ltus=:nskwzDjF8F4iJBVGy4ICko zWgp1a6xT+bpBuXsu3kncnDTj+/3DCY3ybFEzJioWwZ/HEqM7tgLmhbRn2rW9ysAMLvERpOKk 4mM9ef67b6mX6ByhfGtM/besCem036l54jINv5fYAIszooum7duS2ldJrXXOI2y8lIhuqDrvu 5/Hdx6/SmXLOVFTTpJ0A2WDLiuDjwdCtLlXrpdL8mIPTO/5K5AFGEZdB4cWcrbYU8X4OJaDR2 1nEamVKAJY9la/ue+DJqf/oqzErmOPyTpYB2+ApwJf0PrVAkf/f2/2XiRGfLhgmSTDGumH3u2 uL0WieAXSwAYz5B/N64lDxbQJhwmR66wT2Ic3ofbi2Jw+BobY4ifPPD5ksXIi5Fcx0sbMeKjm JKOsQ84Kz9WDQEVfr1bdfrC6SvOH90aRQpdU1Q9pmD6rHDb0nZa9L2hZyQBsJi3D6+S04UVPv 6+csl95/z1jIW3R6kVYnnB97BzGtSuMVy549IeraofIe6RQhJkwEMBbrEutBn7+da2rVZ9qjS eUfSY4cfg58ibqM3EmY/Y/KwtefhfWF9Xqak0Hz/VFgXuxni9SKRlziKAKPMASFatkgKCdLVf mA5QlIFnIGzjtA3v2kEf1o0Sas1CEVbWMMdkWGdwtiFvx0N4465Vs66HG1gC3vB685ZMvVgZd UCcwqcCIxy4OskKMV8oH3SqLh/zxCeWHPHdLSNqj9BioglH54S+NyqBmQ5n+24IQVgWwoiay5 pe3p7Xeqpi64gOL8fpIlBP2OVrdm0n6Mg9oyuJI3SOSkzQJh9TbbS74qmsEfvTKQlPcczCqKQ B0OZSLj Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1939 Lines: 62 From: Markus Elfring Date: Tue, 3 Nov 2015 21:10:51 +0100 The variables "tt_local_entry" and "tt_global_entry" were eventually checked again despite of a corresponding null pointer test before. Let us avoid this double check by reordering a function call sequence and the better selection of jump targets. Signed-off-by: Markus Elfring --- net/batman-adv/translation-table.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 965a004..3ac32d9 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -3323,27 +3323,24 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, return false; if (!atomic_read(&vlan->ap_isolation)) - goto out; + goto vlan_free; tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid); if (!tt_local_entry) - goto out; + goto vlan_free; tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid); if (!tt_global_entry) - goto out; + goto local_entry_free; - if (!_batadv_is_ap_isolated(tt_local_entry, tt_global_entry)) - goto out; - - ret = true; + if (_batadv_is_ap_isolated(tt_local_entry, tt_global_entry)) + ret = true; -out: + batadv_tt_global_entry_free_ref(tt_global_entry); +local_entry_free: + batadv_tt_local_entry_free_ref(tt_local_entry); +vlan_free: batadv_softif_vlan_free_ref(vlan); - if (tt_global_entry) - batadv_tt_global_entry_free_ref(tt_global_entry); - if (tt_local_entry) - batadv_tt_local_entry_free_ref(tt_local_entry); return ret; } -- 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/