Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4366639rwl; Mon, 3 Apr 2023 04:05:56 -0700 (PDT) X-Google-Smtp-Source: AKy350YOsQjPj0W1Bb5xS99DGLc0/80/KENnEoArXrB1I7LR1kSKdOqnjob0QUVpS+QFjF+LzpxH X-Received: by 2002:a17:903:70b:b0:1a1:ab92:5c6b with SMTP id kk11-20020a170903070b00b001a1ab925c6bmr29714648plb.57.1680519955751; Mon, 03 Apr 2023 04:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680519955; cv=none; d=google.com; s=arc-20160816; b=Gm/z3lVLFW8w9xyMMBAY8Djbi6o3bHhtt42Kq6y8ROS//zC8WVXHug/CEvR7nSZs4d p9CzMwlgBwE9Xu/Gwe14MtB3R0x4qRSRnwavwpjFG9/QpUf8aAqGTaNQRmcCbZyDCAdm 2l2t2GuGjiNVOFPkBYA7kPUjJ896ViPwBfQ8ykE4c/C09CithCtbgRplQbyuSrxcLfCB mEFHvCA+gpkrQm48r2v/x/w7SlwLkqtTgQaQZ2sKezeqYKx/BHPTHG5ofQ0stohvWJTL Vjs6P4nkd4iKFhN7ZEHi+5xovQduKfH7KZ76OTItpONFX7pi0C18cXoFyilPS6YsWea7 Lsug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ORNE5FRmOKWFTYbSD7tRSFvdZisp89jLtfgvi4gNMlA=; b=0zUP+AQmQIJ678otP8/7pRPMsb3L/nHxwJCPCX35oTBN87bAOvKC2qR+PNITB/Q/TF IuSLiZU0LV9v/8PMJdm5Fv3ckLQ2PG2/nOrZuQr+xyn1beKBHm4RAWtbu+RteLH9KL1x CV9dvmtja34ijHtcC9xWSH9ZuPeev/0V0CLhCYY8y3/YATz+FfanAfser2LWWqxDBo3R VwNFev5hA1G0vzqC6GKzcBljlmEiCRiJf3vrMq1LkZ3x9F2P4vTYWtqIoXVGNcg8xOAo JHfT1oPeJXW7Ot0ouqEKRMZlZn1JbEMyDlLSzX8ktqYeCx2vXreb79NHVx5OtaqfdFX5 R/BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=ikkLSowg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i31-20020a63221f000000b00502ee712648si8118382pgi.578.2023.04.03.04.05.43; Mon, 03 Apr 2023 04:05:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=ikkLSowg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231946AbjDCK67 (ORCPT + 99 others); Mon, 3 Apr 2023 06:58:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231783AbjDCK65 (ORCPT ); Mon, 3 Apr 2023 06:58:57 -0400 Received: from forwardcorp1c.mail.yandex.net (forwardcorp1c.mail.yandex.net [178.154.239.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84582EB7C; Mon, 3 Apr 2023 03:58:55 -0700 (PDT) Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:19a8:0:640:4e87:0]) by forwardcorp1c.mail.yandex.net (Yandex) with ESMTP id 768F25F228; Mon, 3 Apr 2023 13:58:53 +0300 (MSK) Received: from [IPV6:2a02:6b8:b081:8014::1:2c] (unknown [2a02:6b8:b081:8014::1:2c]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id owKZdU0OeKo0-8INAhgp8; Mon, 03 Apr 2023 13:58:52 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1680519532; bh=ORNE5FRmOKWFTYbSD7tRSFvdZisp89jLtfgvi4gNMlA=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=ikkLSowgdNYie4Ye9MMbdUrX+Qk2htQyDuBLP3nyEy52MlYPmkVaatS/kz5YWTemX V91/E5cLfFiOJFPJIVnEc3EaGx5uwJbyqCAw535kA9eVYd3i9AtwOzkO0oBh+1pLCt 3HcCqlyNYkyzlgvhbKEj2QzohXbmXMJjDg8Vaysw= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru Message-ID: Date: Mon, 3 Apr 2023 13:58:49 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] qlcnic: check pci_reset_function result Content-Language: en-US To: Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, shshaikh@marvell.com, manishc@marvell.com, GR-Linux-NIC-Dev@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com References: <20230331080605.42961-1-den-plotnikov@yandex-team.ru> From: Denis Plotnikov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31.03.2023 20:52, Simon Horman wrote: > On Fri, Mar 31, 2023 at 11:06:05AM +0300, Denis Plotnikov wrote: >> Static code analyzer complains to unchecked return value. >> It seems that pci_reset_function return something meaningful >> only if "reset_methods" is set. >> Even if reset_methods isn't used check the return value to avoid >> possible bugs leading to undefined behavior in the future. >> >> Signed-off-by: Denis Plotnikov > nit: The tree this patch is targeted at should be designated, probably > net-next, so the '[PATCH net-next]' in the subject. > >> --- >> drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c >> index 87f76bac2e463..39ecfc1a1dbd0 100644 >> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c >> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c >> @@ -628,7 +628,9 @@ int qlcnic_fw_create_ctx(struct qlcnic_adapter *dev) >> int i, err, ring; >> >> if (dev->flags & QLCNIC_NEED_FLR) { >> - pci_reset_function(dev->pdev); >> + err = pci_reset_function(dev->pdev); >> + if (err && err != -ENOTTY) > Are you sure about the -ENOTTY part? > > It seems odd to me that an FLR would be required but reset is not supported. No, I'm not sure. My logic is: if the reset method isn't set than pci_reset_function() returns -ENOTTY so treat that result as ok. pci_reset_function may return something different than -ENOTTY only if pci_reset_fn_methods[m].reset_fn is set. >> + return err; >> dev->flags &= ~QLCNIC_NEED_FLR; >> } >> >> -- >> 2.25.1 >>