From patchwork Fri Feb 22 15:25:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 1046977 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="WXNotICH"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 445ZtM3N3tz9s5c for ; Sat, 23 Feb 2019 02:26:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727221AbfBVPZ7 (ORCPT ); Fri, 22 Feb 2019 10:25:59 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:33145 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726656AbfBVPZ7 (ORCPT ); Fri, 22 Feb 2019 10:25:59 -0500 Received: by mail-lj1-f196.google.com with SMTP id z7so1819777lji.0 for ; Fri, 22 Feb 2019 07:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uFbrY32NXUwup51qKdt/oIHZov4twGH23PmbEaftP40=; b=WXNotICHc85DVsqB0RFUEdDKvFzYnweGa08nK+8iCeM+OBTuuWlLi0sJGOHqCqvrrQ uzwGQbK4x+L889I7caEjO7EPQ2+Hv9Z51uvvlFlVdkNVD0E+F0r36QfTN6yTT6tRcyyC ukfMFuiQdnM9ikeOFcpAY30qa6wf7mK96dki/N5wY8i2P3Qz2KWhyOyYv3XFzPSrKh2K zXzGJf9mewgl6DqQOTht8eNLNaue87ZsV6453g8rFBlgS7k/nG5H8z+lDsrxYYYOYNdb w/r24OEuD6gtBUaO8rc7BMSTqFQmQtY7YHoi6W1v9yTtMKonkebYXeKHp0vwOQE+ArF9 qcFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uFbrY32NXUwup51qKdt/oIHZov4twGH23PmbEaftP40=; b=ad5Amz3DyGr6RM/aMx/bA341ymvKtC/tzLSztUizk7VOr/18rLrWCH46J/uuXlV4d8 HPD6hirCNUC2n6mv0TFMKSuJdvvFbtiK7ageqJM5SYDUA7K5C2VdDouOSV7j876xgl+i WrMl3nq5eMiHGSgfaivGFwMhuGVB/vKYjVxf08ruzY1Eh0wBChoad1YiCYRbOpcouZwP eivJjd/GgQoyTo0t8JdrgrRy+ohVw6nj60wVqzyjhrzIoSjl9WxbtwrWkP6nZG5c46PQ n0GiHH/E154S+Qwk30AhgteWnoXjZUubhFvY3t8UWe7HJgjcHMTuRgxdbssuK1zJmGMz ANpQ== X-Gm-Message-State: AHQUAuYtn3pCsznovqayfzriwi6fCqYfIgEoPzgjQzesBKXgtZmtg7cb fVUtz0FhCX3kXYVkllMvU1127PWaqbc= X-Google-Smtp-Source: AHgI3IZK1H3fL+Ht/MlRCv0jSWpnFf6U7dZ1Dp9vUfvUgguco6YmdDZXIAQ/lhMJkwsG1yF5k/rrkw== X-Received: by 2002:a2e:6309:: with SMTP id x9mr2601367ljb.75.1550849156868; Fri, 22 Feb 2019 07:25:56 -0800 (PST) Received: from localhost (c-573670d5.07-21-73746f28.bbcust.telenor.se. [213.112.54.87]) by smtp.gmail.com with ESMTPSA id r80sm624932lff.33.2019.02.22.07.25.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 07:25:56 -0800 (PST) From: Anders Roxell To: mareklindner@neomailbox.ch, sw@simonwunderlich.de, a@unstable.cc, davem@davemloft.net Cc: b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Anders Roxell Subject: [PATCH] batman-adv: fix warning in function batadv_v_elp_get_throughput Date: Fri, 22 Feb 2019 16:25:54 +0100 Message-Id: <20190222152554.30006-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When CONFIG_CFG80211 isn't enabled the compiler correcly warns about 'sinfo.pertid' may be unused. It can also happen for other error conditions that it not warn about. net/batman-adv/bat_v_elp.c: In function ‘batadv_v_elp_get_throughput.isra.0’: include/net/cfg80211.h:6370:13: warning: ‘sinfo.pertid’ may be used uninitialized in this function [-Wmaybe-uninitialized] kfree(sinfo->pertid); ~~~~~^~~~~~~~ Rework so that we only release '&sinfo' if cfg80211_get_station returns zero. Signed-off-by: Anders Roxell --- net/batman-adv/bat_v_elp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c index a9b7919c9de5..d5df0114f08a 100644 --- a/net/batman-adv/bat_v_elp.c +++ b/net/batman-adv/bat_v_elp.c @@ -104,8 +104,10 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) ret = cfg80211_get_station(real_netdev, neigh->addr, &sinfo); - /* free the TID stats immediately */ - cfg80211_sinfo_release_content(&sinfo); + if (!ret) { + /* free the TID stats immediately */ + cfg80211_sinfo_release_content(&sinfo); + } dev_put(real_netdev); if (ret == -ENOENT) {