From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 745C2C3A5A1 for ; Wed, 21 Aug 2019 15:01:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A7F32339F for ; Wed, 21 Aug 2019 15:01:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="ieAJQEap" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728636AbfHUPBu (ORCPT ); Wed, 21 Aug 2019 11:01:50 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:18390 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727725AbfHUPBu (ORCPT ); Wed, 21 Aug 2019 11:01:50 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Wed, 21 Aug 2019 08:01:50 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 21 Aug 2019 08:01:49 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 21 Aug 2019 08:01:49 -0700 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 21 Aug 2019 15:01:48 +0000 Received: from [10.25.74.119] (10.124.1.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 21 Aug 2019 15:01:45 +0000 Subject: Re: [PATCH][next] PCI: tegra: tegra194: fix phy_count less than zero check To: Lorenzo Pieralisi , Colin King CC: Bjorn Helgaas , Thierry Reding , Jonathan Hunter , , , , References: <20190821120123.14223-1-colin.king@canonical.com> <20190821140520.GA691@e121166-lin.cambridge.arm.com> X-Nvconfidentiality: public From: Vidya Sagar Message-ID: Date: Wed, 21 Aug 2019 20:31:42 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190821140520.GA691@e121166-lin.cambridge.arm.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1566399710; bh=pVlgGlKM4Jh1fIne7Jt+bEk9BU5YPhXW/fJ0EL5D3i0=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=ieAJQEapTwKUlGo+Q8ZuJRxc3YyGSLmWch2L8LcayRGH5N0ErNoOpMcrvwQHFPZG1 ufkTAF8FE2/xnJakffaGEHr4XV4cfPpFpV75oQ2TZGd6EbEMNXqXY3RWmwUj5ctkYM o6FrcfLw+K0XjJZV7I3R38nNpMyx8SkbPVFBIRZa1lXVAiYT61pI6IhUXjUdDr9Wn0 6/y6mHm8cCQLQSq+alPn9TFftPTcMCEs/bIlOqN3fI7TpzVS+M5FL+qgz++YxzllEJ ka43K4LBbsYZKHcAmQtTckmwY54/ZYkH7VpcLDFvv0U6x0sJuWSfGH4cdmDi21fX8u TMThaA3dSQwDw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/21/2019 7:35 PM, Lorenzo Pieralisi wrote: > On Wed, Aug 21, 2019 at 01:01:23PM +0100, Colin King wrote: >> From: Colin Ian King >> >> The check for pcie->phy_count < 0 is always false because phy_count >> is an unsigned int and can never be less than zero. Fix this by >> assigning ret to the return from of_property_count_strings and >> checking if this is less than zero instead. >> >> Addresses-Coverity: ("Dead code") >> Fixes: 6404441c8e13 ("PCI: tegra: Add Tegra194 PCIe support") >> Signed-off-by: Colin Ian King >> --- >> drivers/pci/controller/dwc/pcie-tegra194.c | 9 +++++---- >> 1 file changed, 5 insertions(+), 4 deletions(-) > > Squashed in the original commit (it is not merged yet), thanks > for reporting it. Thanks Colin for catching it and pushing a fix also. Thanks Lorenzo for merging it. Apologies for missing this in my patch series. > > Lorenzo > >> diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c >> index fc0dbeb31d78..b47ea3e68303 100644 >> --- a/drivers/pci/controller/dwc/pcie-tegra194.c >> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c >> @@ -969,12 +969,13 @@ static int tegra_pcie_dw_parse_dt(struct tegra_pcie_dw *pcie) >> return ret; >> } >> >> - pcie->phy_count = of_property_count_strings(np, "phy-names"); >> - if (pcie->phy_count < 0) { >> + ret = of_property_count_strings(np, "phy-names"); >> + if (ret < 0) { >> dev_err(pcie->dev, "Failed to find PHY entries: %d\n", >> - pcie->phy_count); >> - return pcie->phy_count; >> + ret); >> + return ret; >> } >> + pcie->phy_count = ret; >> >> if (of_property_read_bool(np, "nvidia,update-fc-fixup")) >> pcie->update_fc_fixup = true; >> -- >> 2.20.1 >>