From patchwork Tue May 9 17:09:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13236036 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5437519503 for ; Tue, 9 May 2023 17:13:07 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25BBBBE for ; Tue, 9 May 2023 10:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683652386; x=1715188386; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cPepQWlzZsaK6orMAe7HW0FNutCMdqMQPuFKOJdA/ls=; b=Mon/lZRctIhZObI0N2O3nkEAUmDj6Epv5RH8iOnchTaBghUZr/OJ7IHb gIi0U3fCTbp2NGnfvhHpqjdvaauL/Hl8VLDcWYrVb+fQI8cFjYgW5yYSN 0Q6gojCXuNOCRhUh19BNzDocuTjwlyX7bBibOSa2M908rEFvImN1rGwwi TrO2OTqh0NvVBBbnYsPHIhGZtp+jME+bw4iOe5HkKVz6m6dgDYxeSrZoN lH+VJXuTvsLAnNGvRhyjJfRnniRKxZa+Gyun4sIX8XUUrjB5qj130X2O0 yM5f9x5daJktp5Sgq4MClztrRKbh8qmPLsi7/EQ2nMTYjXWt91R12qOU8 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="339227636" X-IronPort-AV: E=Sophos;i="5.99,262,1677571200"; d="scan'208";a="339227636" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2023 10:13:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="729601148" X-IronPort-AV: E=Sophos;i="5.99,262,1677571200"; d="scan'208";a="729601148" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orsmga008.jf.intel.com with ESMTP; 09 May 2023 10:13:03 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Aleksandr Loktionov , anthony.l.nguyen@intel.com, Pucha Himasekhar Reddy Subject: [PATCH net 3/3] igb: fix nvm.ops.read() error handling Date: Tue, 9 May 2023 10:09:35 -0700 Message-Id: <20230509170935.2237051-4-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230509170935.2237051-1-anthony.l.nguyen@intel.com> References: <20230509170935.2237051-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org From: Aleksandr Loktionov Add error handling into igb_set_eeprom() function, in case nvm.ops.read() fails just quit with error code asap. Fixes: 9d5c824399de ("igb: PCI-Express 82575 Gigabit Ethernet driver") Signed-off-by: Aleksandr Loktionov Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index 7d60da1b7bf4..99b6b21caa02 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -822,6 +822,8 @@ static int igb_set_eeprom(struct net_device *netdev, */ ret_val = hw->nvm.ops.read(hw, last_word, 1, &eeprom_buff[last_word - first_word]); + if (ret_val) + goto out; } /* Device's eeprom is always little-endian, word addressable */ @@ -839,7 +841,7 @@ static int igb_set_eeprom(struct net_device *netdev, /* Update the checksum if nvm write succeeded */ if (ret_val == 0) hw->nvm.ops.update(hw); - +out: igb_set_fw_version(adapter); kfree(eeprom_buff); return ret_val;