From patchwork Sat Oct 24 20:29:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Krause X-Patchwork-Id: 535872 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 5D1C91412FD for ; Mon, 26 Oct 2015 22:35:32 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=QPCsfGn1; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A3A568AA78; Mon, 26 Oct 2015 11:35:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vI0jfrXiJvWt; Mon, 26 Oct 2015 11:35:31 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id EB7A38AE88; Mon, 26 Oct 2015 11:35:28 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 0D11E1C1EB6 for ; Sat, 24 Oct 2015 20:29:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 06002884B8 for ; Sat, 24 Oct 2015 20:29:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WoU4+IptvP8j for ; Sat, 24 Oct 2015 20:29:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qk0-f170.google.com (mail-qk0-f170.google.com [209.85.220.170]) by whitealder.osuosl.org (Postfix) with ESMTPS id 4790888479 for ; Sat, 24 Oct 2015 20:29:35 +0000 (UTC) Received: by qkbl190 with SMTP id l190so95186790qkb.2 for ; Sat, 24 Oct 2015 13:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=XRGW6HyIwXvXoP3KvSMdLn+5KDIRjZoZaqqqe0r1w2g=; b=QPCsfGn1XTsYmxi9oyI+lEpzu9QneHfQALH9Kqie9Gy3GwnpOd3BRB3q+GAnbSp1IT qGjhxPwvnqJjN41I+uhiL/lZI1ZD+uuNNLRiBYzuvRRPema8/e/7jZwP/UzHyx2XHS0O jkF0HTpQCfHnRoQcuXSgJPODRrNSk2YE2rDW/pVPKIXyF9ql/rjkzFR9NJvgQZTny185 yqHVv53Todr9bqELuUzZTWJd9igNHTCkYM6Qic5U3aETVi4gFlwxWUeaWWJosZhNGTtc DUZJ9lNTUaR8CTHd5KSyAqC04W6ZiudcvFW6d/bH24YovFRpZFe58KwY3rSVdQJfTDjU hWNQ== X-Received: by 10.55.192.13 with SMTP id o13mr32972294qki.83.1445718574548; Sat, 24 Oct 2015 13:29:34 -0700 (PDT) Received: from nick-System-Product-Name.hitronhub.home (CPEbc4dfb2691f3-CMbc4dfb2691f0.cpe.net.cable.rogers.com. [99.231.110.121]) by smtp.googlemail.com with ESMTPSA id d64sm9947597qgf.34.2015.10.24.13.29.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Oct 2015 13:29:33 -0700 (PDT) From: Nicholas Krause To: jeffrey.t.kirsher@intel.com Date: Sat, 24 Oct 2015 16:29:30 -0400 Message-Id: <1445718570-30162-1-git-send-email-xerofoify@gmail.com> X-Mailer: git-send-email 2.1.4 X-Mailman-Approved-At: Mon, 26 Oct 2015 11:35:27 +0000 Cc: linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: [Intel-wired-lan] [PATCH] ixgbe:Refactor ixgbe_set_vf_mac to include proper error path and return statement X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" This fixes the function ixgbe_set_vf_mac to include the proper path when the call to the function ixgbe_del_mac_filter fails and we must exit immediately by returning the error code returned by this particular function call. Further more return ixgbe_add_mac_filter directly in order to allow callers to be signaled also when the call to this particular function fails in ixgbe_set_vf_mac. Signed-off-by: Nicholas Krause --- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 1d17b58..711b451 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -552,11 +552,13 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter, int vf, unsigned char *mac_addr) { - ixgbe_del_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); - memcpy(adapter->vfinfo[vf].vf_mac_addresses, mac_addr, ETH_ALEN); - ixgbe_add_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); + int err; - return 0; + err = ixgbe_del_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); + if (err) + return err; + memcpy(adapter->vfinfo[vf].vf_mac_addresses, mac_addr, ETH_ALEN); + return ixgbe_add_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); } static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,