Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp615183rdg; Thu, 12 Oct 2023 16:03:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOxkLx683ozoz0FW5pchcv7iGKxewynQHLAQ42l/QtZV1BpaO8EITWo4y8BM+LglsCjs3r X-Received: by 2002:a17:90b:3642:b0:27d:dc9:c67d with SMTP id nh2-20020a17090b364200b0027d0dc9c67dmr5211420pjb.36.1697151832978; Thu, 12 Oct 2023 16:03:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697151832; cv=pass; d=google.com; s=arc-20160816; b=R9MxVxE5uLEn48eA/bWwDBmKD/phnH0/O1oQ8QjeJzoFRy3pmXZZAfgTJxN2RP2VRG cVE+OTvaeiCLmCGDUkg5/lIkb2gcjrDfBZTj6DMFTRyLyoaLTDkAKkY0GBHCgpVnd4aA KPJ1DdP3b3jaAZfFOy39F/J58A3KxPizOQKuqyylHSj/IwcRndG2TicIJ7VPsC83LhZT ezWDu8obpHki/ss7ssM2OXI181G6FBY2/RW1wGXjRQ3adlThvY1C7ccOkK+lAllZwR6I YsHnlUEePj9H+ZplAahl/pmmb3DdeYbAoOK8jTzPvDOnLHM1hDcSsT61osEK0JxJorJ1 TPvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fjkzFype70iW0b9GFHLXH8amblyeWcr+4vuVvmjUEYU=; fh=mlCa8NrV6+BLn8HFaaP4kCx628w3pMmHWveKleIlcsc=; b=b0DLNFMdpxzjKZRtUdd/jW+tBbIU4hf+9RsZNH/O6vo5DIx1CqsPsMx5u9ZX9dJc7E BGtECTGjywrkkZfNVSt0v9VYqdgd+DTXkStObvggk0O+QbpFaZQAmOvIqGhkFxoPNpg3 sR2bDkxp9jxhKrBWI3MbwKuT/287yFSwB/QAW1oQ+cgxKyAXNWAYXIrM99B5E1gZGr37 mJ0ZIk3CC2O6yImfmpd2VxNdAP4ANUhBYimWe2MH1I5kOI1TpNOLcyBRvnj9Z9IfecJE 7WjcR21Fp6u/2sQGJQh+KpJGun3dwd0v9SxTPSGpT3zt543v+lLcJ7JdTXQCz+gACTsv vU9w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=NVyALjhL; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id l7-20020a17090ac58700b002774e11ca41si3197869pjt.67.2023.10.12.16.03.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 16:03:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=NVyALjhL; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id ADF6581ABAE0; Thu, 12 Oct 2023 16:03:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443134AbjJLXDT (ORCPT + 99 others); Thu, 12 Oct 2023 19:03:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443114AbjJLXDP (ORCPT ); Thu, 12 Oct 2023 19:03:15 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2081.outbound.protection.outlook.com [40.107.102.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CEEDD7; Thu, 12 Oct 2023 16:03:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cqYaAj1v34RBKJJ77Pkm9dleoQzBDCFpNmun2gU0968UljZvszR8BP8poizOzzqHcJOy85iZIJEqide4bMkSqfZWe4LGb8uaD6G+tl1Pvusbd0G+88K/q0i9dOTuiZQJwwHLA1nVzqsM95cOhLZyXNcCbT316T7wA5CrhaF+Bs+HwnTSVujekzAZy2R8wBmEVgG0rwpRvNw0Y1GJPDn+pCZN4YX4WWmgwrqyTJoEBz28bP92LeOArnU9nfspcmLJvY3lOUOv8CF0623+n3ORFRxcBizfuY2ol+K3ljWgvv3QV9kALWaTXXwNHyUbJ4W+Hf1jH4zjPY2MCYLU9pnBRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fjkzFype70iW0b9GFHLXH8amblyeWcr+4vuVvmjUEYU=; b=T32uOaQttJg22UbkOP9rVYMIC5dOQsOb/PbXI+eVncEVWCLTktzYKHB6TKEBBxg/p1VflBg6YO6XxsjtzujBlBmpdGKliGITc7fBk8HAn4fxvMP39eOHLDiv1VCxIpGp9vzMNY1RVxeono3j4nsHX6OjEanmFs6s6F8Njp8BTQLagYFSsphrJ54dpRp7LDO6Zlf74qtdRahZW9oDrMEVRn8udytGJkOJkgLTTwim8QjjAiKaqYrY2KUtPeKzEFmHyPNokKwfZIO5/nmmCXkPv7iEGORa/EropFmBknnDvqkRcqXh23a7U8Ei+RPlYtoOJURIEm6FqWMmq4zssQrbDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fjkzFype70iW0b9GFHLXH8amblyeWcr+4vuVvmjUEYU=; b=NVyALjhLLVsllt1lBg7//VFIcFmFOvrpnr9TfWQj+FD1dg3ZJWasyl22xPbxkwbQbZUNhCn2hmddLHDcPf+hoszhjUZ3ss7j3MGpwaP3IcAUnrtv88IHFsoT+CTLIwJhom/gdSHfRLvsRLrXL5tPpmBIy4H6nY8zF5DPb3t3FpNDmO3pDdg0Dy9X2puDWLrUio/KI88PMdkFa1V7IscBLErrRUJ6iQVDbC2TcApZpsd6r0ZYzUQjUSdlOZnT6olH8HX5UaJaSJtQBfQSgBXyNqQC99SlKaIAZWE2ZfYPXA1S+qDfG/PdCxvXdXh7gqq21Y98xdntTF67UyrQTkrz1w== Received: from MW4P223CA0030.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::35) by CH3PR12MB8331.namprd12.prod.outlook.com (2603:10b6:610:12f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.37; Thu, 12 Oct 2023 23:03:02 +0000 Received: from CO1PEPF000044F1.namprd05.prod.outlook.com (2603:10b6:303:80:cafe::87) by MW4P223CA0030.outlook.office365.com (2603:10b6:303:80::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Thu, 12 Oct 2023 23:03:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1PEPF000044F1.mail.protection.outlook.com (10.167.241.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Thu, 12 Oct 2023 23:03:01 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 12 Oct 2023 16:02:39 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 12 Oct 2023 16:02:39 -0700 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Thu, 12 Oct 2023 16:02:38 -0700 From: Liming Sun To: Vadim Pasternak , David Thompson , Hans de Goede , Mark Gross , Dan Carpenter CC: Liming Sun , , Subject: [PATCH v2] platform/mellanox: mlxbf-tmfifo: Fix a warning message Date: Thu, 12 Oct 2023 19:02:35 -0400 Message-ID: <20231012230235.219861-1-limings@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F1:EE_|CH3PR12MB8331:EE_ X-MS-Office365-Filtering-Correlation-Id: e513000d-718a-4ed9-338f-08dbcb7762a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5QKujscur9SY2RPsOdDZ4/qUME5/O+qcjPkkOWDgJKqsritg2Ho31B0BfiPN2h6nfewUcu2zWxjsJVfXKh2oMlNHldMQDIxB8va2a+GnFuESGlqhsC3eLh1lQg5gsqbtoDkNfNWB0rLEiqy3bGt0J3qTfUxUU6SKqBxjpXF4ldo8tIVFrKr7J1O/hLz9mortuxhAZzILiwhXKNtf0q1mUYdfCD3uwaTPkfW0Cym8npZS8gANRJiRPbcUwXkeV1evSbyfGo5/O7NT1Z0gR6rxwvYeTuAds5l8zU5TnIXFmmUxxrRnft6pbwDTo2BKhQsuI4tOyV8UpvNtLIBNOIpfYA6NBNqxXm4HxJYroXkNF0k7ONFIjIimQFAGW9qVsDHvRxfhn+BE/el8Uuibco04uMCg3/l6F+w05G9z3r3kIiE8n0MemUG5Lr+vx0C8OOIuzwJfLT2Xkh1zhL7I8Gcquo7D/V7rzMKHa0NHF5+UTX9e4UgB7A5yT67m2w4L7uvkU9Q9sRE5F+Omw1e7symJxjlCXq4t2Va9GWvuW6hhNYNn1gTgyjVo0UYfxbSTbT6MpMGu7DNcNHpt4WxazP66u8lRuV46x76ZrnmmfrDLWRgZAJp58fo8Ih97Zlf+fM4HHddWNQGLXCoN6zX/3E+Ml5ZQSaZICoYQsx1ICWNrhlhSot90Yr2CS+QB3NAC9N+7T94ZJRAoQxhyLitfzSablfsRulVofKjBPvUU1m62sGafJ555SjYQMkTwV6ZCFwLh X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(376002)(396003)(136003)(39860400002)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(82310400011)(36840700001)(40470700004)(46966006)(40460700003)(478600001)(36756003)(2616005)(1076003)(26005)(426003)(2906002)(336012)(356005)(7636003)(82740400003)(6666004)(83380400001)(86362001)(40480700001)(47076005)(36860700001)(7696005)(110136005)(8936002)(8676002)(4326008)(70206006)(70586007)(54906003)(41300700001)(5660300002)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2023 23:03:01.8750 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e513000d-718a-4ed9-338f-08dbcb7762a4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8331 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 12 Oct 2023 16:03:45 -0700 (PDT) This commit fixes the smatch static checker warning in function mlxbf_tmfifo_rxtx_word() which complains data not initialized at line 634 when IS_VRING_DROP() is TRUE. Signed-off-by: Liming Sun --- v1->v2: Logic adjustment for Hans's comment - Adjust the logic to avoid confusion. v1: Initial version. --- drivers/platform/mellanox/mlxbf-tmfifo.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c index f3696a54a2bd..d9615ad60012 100644 --- a/drivers/platform/mellanox/mlxbf-tmfifo.c +++ b/drivers/platform/mellanox/mlxbf-tmfifo.c @@ -607,24 +607,25 @@ static void mlxbf_tmfifo_rxtx_word(struct mlxbf_tmfifo_vring *vring, if (vring->cur_len + sizeof(u64) <= len) { /* The whole word. */ - if (!IS_VRING_DROP(vring)) { - if (is_rx) + if (is_rx) { + if (!IS_VRING_DROP(vring)) memcpy(addr + vring->cur_len, &data, sizeof(u64)); - else - memcpy(&data, addr + vring->cur_len, - sizeof(u64)); + } else { + memcpy(&data, addr + vring->cur_len, + sizeof(u64)); } vring->cur_len += sizeof(u64); } else { /* Leftover bytes. */ - if (!IS_VRING_DROP(vring)) { - if (is_rx) + if (is_rx) { + if (!IS_VRING_DROP(vring)) memcpy(addr + vring->cur_len, &data, len - vring->cur_len); - else - memcpy(&data, addr + vring->cur_len, - len - vring->cur_len); + } else { + data = 0; + memcpy(&data, addr + vring->cur_len, + len - vring->cur_len); } vring->cur_len = len; } -- 2.30.1