Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5120430ybi; Tue, 4 Jun 2019 01:24:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDMexnZbdiNG9T5xnejji2pTkrjImULqkYXAvyzKdNgwpKSFEAKBFnPISyrbYOmr/ylAVt X-Received: by 2002:aa7:8d8c:: with SMTP id i12mr10920074pfr.200.1559636659900; Tue, 04 Jun 2019 01:24:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559636659; cv=none; d=google.com; s=arc-20160816; b=G7DzOrIgiWi7i2QN9/OWQg+UPWP06BoUtsg/vk16N4SHbSkM73t/K4W7xgsxbW35RC 6Gek3uhi6tL/sX4j5Hc8YiK0P3wGoZUKcGzGgX031JeNnLXvMPT9U5LaPd5AnB9jwkET NM+85iGGVGTCykk6e3xY/i6TWEKxr7Nyo7pPWpx9bN9a30cjkzrP5incTQx/DwvpWZ88 o6bKFVmpcCE0AAnu9fIAkvfp9hL05js9jIrgl9Wo0jtqVdLPwqRHR/r5u05W1T+fLjXI ZS/e4bLdXD7IemyxanxThm/ok8FRZ1Xe7qT9+/cDvbIrbmQqj6wpFwkz07hqTVDM9VTS N52Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=jqGGdLuWH5rSHqmTKpJIrDDQQlLAgRHlA9ir5wzeUd0=; b=nRy/sC8N9hHAnlCvFjroSqzpaYyTTwcOUjPIPXQjwn/p486BlksJTSeyk7CXyjK6R0 Ico0YYuVgOCtPudIeuEe9VXHymg34g/NZlMIpA9yaQasO2GjHKF6elAoD3WaP9sv7Z3w bcoTWvtLCKnapdQBPLhIe2geEJLvnebXzyt4YpkVC4KDbZBDDETNliBwpM6Q4H8vb9LQ Bq3mmADaVtt4W1B5jL7Z9zRaBd+mu+cfmBZ0pht7F7449ahR7Fpql22A8Pwveym0Qx24 oGhO8jehkjWlKlayLPgLt3rDXwVHPUZcZIej8yl+1Y7em04AJNnNrpI2PWQOASshCsuQ idzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y135si24728500pfc.114.2019.06.04.01.24.03; Tue, 04 Jun 2019 01:24:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727027AbfFDIV4 (ORCPT + 99 others); Tue, 4 Jun 2019 04:21:56 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:46645 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726976AbfFDIV4 (ORCPT ); Tue, 4 Jun 2019 04:21:56 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1hY4hW-0000Zg-O1; Tue, 04 Jun 2019 08:21:46 +0000 From: Colin King To: Alexei Starovoitov , Daniel Borkmann , "David S . Miller" , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Magnus Karlsson , netdev@vger.kernel.org, xdp-newbies@vger.kernel.org, bpf@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next][V2] bpf: remove redundant assignment to err Date: Tue, 4 Jun 2019 09:21:46 +0100 Message-Id: <20190604082146.2049-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The variable err is assigned with the value -EINVAL that is never read and it is re-assigned a new value later on. The assignment is redundant and can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King --- V2: reorder variables as recommended by Jakub Kicinski to keep in the networking code style. --- kernel/bpf/devmap.c | 2 +- kernel/bpf/xskmap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index 5ae7cce5ef16..b58a33ca8a27 100644 --- a/kernel/bpf/devmap.c +++ b/kernel/bpf/devmap.c @@ -88,8 +88,8 @@ static u64 dev_map_bitmap_size(const union bpf_attr *attr) static struct bpf_map *dev_map_alloc(union bpf_attr *attr) { struct bpf_dtab *dtab; - int err = -EINVAL; u64 cost; + int err; if (!capable(CAP_NET_ADMIN)) return ERR_PTR(-EPERM); diff --git a/kernel/bpf/xskmap.c b/kernel/bpf/xskmap.c index 22066c28ba61..413d75f4fc72 100644 --- a/kernel/bpf/xskmap.c +++ b/kernel/bpf/xskmap.c @@ -17,8 +17,8 @@ struct xsk_map { static struct bpf_map *xsk_map_alloc(union bpf_attr *attr) { - int cpu, err = -EINVAL; struct xsk_map *m; + int cpu, err; u64 cost; if (!capable(CAP_NET_ADMIN)) -- 2.20.1