Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp283263pxf; Thu, 1 Apr 2021 00:40:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF5FAWWzZ2Lufvn3Av/OBmHK5YAj0slL/VQl4qmM66GXQaadIKh5ksFj554rkujPaoPngl X-Received: by 2002:a05:6402:2552:: with SMTP id l18mr8172978edb.71.1617262815325; Thu, 01 Apr 2021 00:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617262815; cv=none; d=google.com; s=arc-20160816; b=TULwqS+m08nII1/MWdsQc5GUe2H4eI2ftTwKAYCwvATFsV9+WNk+hQMLasnHQ7VTvE qGR3ypvdKFatmWpXaHFlPwkPAcJfz/eiayA9MlMP8x2OnnUuoWtWHvVoj+pwJfPzhv6C afB/LX2ezVuBo5lbpY1pAbIlfjXgLbrg3GMhlnW4wimPu7xbxjfMhHK70asDlJSYghTm 6U8BNGgb6vhf3nM5Mjo18t9DKUM/6ieDgPPxnhHTx44fTKplrgSs1GeInA2MPsQTktld 0JkDcG8P8Xb+mThQ+8m4hK6bPbgmpL/SpEYsmo13MUWEdslCeg7MkgSTZIea/qqpw0kJ cW8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:dkim-signature; bh=WWW5KQRNRxIfVZ3a4k8eNejbWBDO6eEvx40V0Y5LbCk=; b=c8NnzMRaD4AyXQ6rY86ppkjjkA0KKcQuxYn17Of8m3lJWOrGdwh5pzsgkggsi/eYfK goADGJbv0SK8tpdSM7Fsghu4TQvFCQvSOPoLRqn3uj707fmnsOBSffIpibFV21ZMSoBN nYvnm8QAJsQDg/tujmkd3TtYlzX0dmYhlcFskDJmuQH0saIBQEFAf1mIdTgx6FATA6vT gdBqhpIRc8L0ypdwYntppezsEf1FzMayc9co74uHDqGF53mC4fBGZfGvZCYO6dJWAf+q Uk/Q/Q6yeJFr22peUaj6rLDswKWES7YhpTdRbtvEcbY01af2ZlVkHUieZQQhpXpTkWJ3 gjQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wo9A9F8w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u2si3504893ejg.288.2021.04.01.00.39.53; Thu, 01 Apr 2021 00:40:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wo9A9F8w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233491AbhDAHir (ORCPT + 99 others); Thu, 1 Apr 2021 03:38:47 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:38708 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233240AbhDAHio (ORCPT ); Thu, 1 Apr 2021 03:38:44 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1317cQQq023201; Thu, 1 Apr 2021 02:38:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1617262706; bh=WWW5KQRNRxIfVZ3a4k8eNejbWBDO6eEvx40V0Y5LbCk=; h=Subject:To:References:From:Date:In-Reply-To; b=wo9A9F8wsY8c7XJAoOnn3DsjIXe0Se+lIgA6DaWjemTzN8+01TwdtygpxnSitY7qW Gbr0HLdl2F6ggdfASq5ZeY9rsrgjv0rKKMT4jZnFUwF3tXtHmiMjuuAxeUBoA+kCTB /ClBYaPoryl0Ubi0wYoTetCdBTQdYwNKamzyVmMU= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1317cQT9013766 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Apr 2021 02:38:26 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 1 Apr 2021 02:38:25 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Thu, 1 Apr 2021 02:38:25 -0500 Received: from [10.250.234.178] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1317cMoQ047576; Thu, 1 Apr 2021 02:38:23 -0500 Subject: Re: [Discussion] Uninitialized variable in wiz_mode_select() To: Muhammad Usama Anjum , Vinod Koul , "open list:GENERIC PHY FRAMEWORK" , open list , , , References: <943b92c6ac291726cf0e6bd92e88f2110c14b74c.camel@gmail.com> From: Kishon Vijay Abraham I Message-ID: Date: Thu, 1 Apr 2021 13:08:21 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <943b92c6ac291726cf0e6bd92e88f2110c14b74c.camel@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Usama, On 01/04/21 1:03 pm, Muhammad Usama Anjum wrote: > Hi, > > `mode` remains uninitialized when `lane_phy_type` isn't PHY_TYPE_DP > or > PHY_TYPE_QSGMII. I've checked the dtsi (k3-j721e-common-proc- > board.dts) > and possible values of `lane_phy_type` are justPHY_TYPE_USB3 and > PHY_TYPE_PCIE. If this is correct, the mode will remain uninitialized with > garbage value. `mode` should be initialized to what? It seems like it is highly > implementation dependent. > > /drivers/phy/ti/phy-j721e-wiz.c: 344 in wiz_mode_select() > 338 for (i = 0; i < num_lanes; i++) { > 339 if (wiz->lane_phy_type[i] == PHY_TYPE_DP) > 340 mode = LANE_MODE_GEN1; > 341 else if (wiz->lane_phy_type[i] == PHY_TYPE_QSGMII) > 342 mode = LANE_MODE_GEN2; > 343 >>>> CID 1503592: Uninitialized variables (UNINIT) >>>> Using uninitialized value "mode" when calling "regmap_field_write". > 344 ret = regmap_field_write(wiz->p_standard_mode[i], mode); > 345 if (ret) > 346 return ret; > 347 } > 348 > 349 return 0; I've sent a follow-up patch fixing this. http://lor.kernel.org/r/20210331131417.15596-1-kishon@ti.com Thanks Kishon