Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752346AbdLGWjP (ORCPT ); Thu, 7 Dec 2017 17:39:15 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:36947 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752252AbdLGWjN (ORCPT ); Thu, 7 Dec 2017 17:39:13 -0500 X-Google-Smtp-Source: AGs4zMY65oF1DCietzNbt/5lYiiFySRq/5LO1V3afQUlpEDMG4GyZAfYvxjMiK6TgDh5AzjAx1xPlg== From: Vasyl Gomonovych To: jeffrey.t.kirsher@intel.com, intel-wired-lan@lists.osuosl.org, gomonovych@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: intel: e100: Fix warning of passing zero to 'PTR_ERR' Date: Thu, 7 Dec 2017 23:39:02 +0100 Message-Id: <1512686342-6920-1-git-send-email-gomonovych@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 793 Lines: 25 fw could be NULL and put into PTR_ERR also zero in PTR_ERR will be translated into success return statement Signed-off-by: Vasyl Gomonovych --- drivers/net/ethernet/intel/e100.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index 4d10270..55e399d 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c @@ -1370,7 +1370,9 @@ static inline int e100_load_ucode_wait(struct nic *nic) fw = e100_request_firmware(nic); /* If it's NULL, then no ucode is required */ - if (!fw || IS_ERR(fw)) + if (!fw) + return -EINVAL; + else if (IS_ERR(fw)) return PTR_ERR(fw); if ((err = e100_exec_cb(nic, (void *)fw, e100_setup_ucode))) -- 1.9.1