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 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8488BC3DA78 for ; Sat, 14 Jan 2023 14:04:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0A3444157A; Sat, 14 Jan 2023 14:04:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0A3444157A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1673705077; bh=2uVxxFyzml45MDxqqNzfXZqvIYBwN4ssEEwhD1DPoaI=; h=From:To:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=ttNsQ0d25snq070Wa6Cxi/BLIQbotjUlWk48zPxhZ/cUgRyMquMsAoDReMqTTTQjR Dv2fgccMmFiguUXg4kclbbIFdgv8Fu0KEr/KfrQj4MukEvO84tTwSV3jP9Pj+0TzU6 P6gi/KbT4IS14w8cC6nA564lFkaqaoKWVeNeGq1tYDz8gmBlatPhqgDhCGNFoJpIJx rYgcEeKFC0kJxnjlOZAbb7ARWhL9EX4Cv9WdpnBs4eZz85ezCAW2bMBCCic6OUGO20 dW0VNKxv0POHscSPIU771e8Yu5LnM9hU/kodHFJP5tmZ+YbvtGdsx5/8SpsQWtagn1 dBj7M7bW68dkQ== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xqaRgMZ5coCZ; Sat, 14 Jan 2023 14:04:36 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id ACCDD4157D; Sat, 14 Jan 2023 14:04:35 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org ACCDD4157D Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 3CEC61BF316 for ; Sat, 14 Jan 2023 14:04:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 150744157D for ; Sat, 14 Jan 2023 14:04:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 150744157D X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Zo1Ef2kp_JD0 for ; Sat, 14 Jan 2023 14:04:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org DB5DA4157A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id DB5DA4157A for ; Sat, 14 Jan 2023 14:04:32 +0000 (UTC) Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-616-GlXNv0JLNPe5X1G9yAS2Vw-1; Sat, 14 Jan 2023 09:04:30 -0500 X-MC-Unique: GlXNv0JLNPe5X1G9yAS2Vw-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-4dd4d4591f7so55822257b3.15 for ; Sat, 14 Jan 2023 06:04:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6F2gTFb1ZrF9f6ES4DXTz8rBxEV3JQ1L7+17Uewwhrc=; b=7k4IPYrZW4XNtk7tPxaDoOdhLNYEAJQGaTH8+UXYWTl8Aqj++gX4dMoPwLu7yvSIpd tb/vWftRmg8mFuw4h9IwVkklS92HxYnVnxntpQWirVAdnpHsuD3/5p1XaLxHkiAuTmjh tNljgbxdgMkf/onRzNO4dG4+jc6yrSMy/T/yCO2V3Xgw4BIPseeB1Zxc9TgkgBVKSeUW Ggmg7a9jiX/VBBVS/5mTz6wNZy48MC1Orm3j1Es/KO/f/yitBWHkFf7ApQzLTWXSvnmf 5NprfFTu+RYRy0T79Velr144sMZw9Oe6F8ZvY3yOsTN6ff3JF2TmJKcBznfjVTLoPIif wB9g== X-Gm-Message-State: AFqh2koQBsjuj1/FNRo5A8PNH8avKmMyCf5B4WHv+GZRaWkULvIEx50n D6NiWx/UYAEeaRd6dWNvHwAbdAa170f3Dqg54VQMGTilOiDu6mcMr/TQ8zFl3UAdJC14aOK78q6 WFRitcQ1pa0czHVDljpJJ9npvBQp/qQ== X-Received: by 2002:a05:7500:398d:b0:f1:c205:b468 with SMTP id lu13-20020a057500398d00b000f1c205b468mr303198gab.48.1673705069471; Sat, 14 Jan 2023 06:04:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXsVpjjeHbW3FsEjFjGQmccrBWIuIWhHpfGIsTLiovScnaV9wcQ0yrSXBbBjxnBKtOpqCbSnHw== X-Received: by 2002:a05:7500:398d:b0:f1:c205:b468 with SMTP id lu13-20020a057500398d00b000f1c205b468mr303174gab.48.1673705069108; Sat, 14 Jan 2023 06:04:29 -0800 (PST) Received: from dell-per740-01.7a2m.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id br43-20020a05620a462b00b006ec771d8f89sm14675789qkb.112.2023.01.14.06.04.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Jan 2023 06:04:28 -0800 (PST) From: Tom Rix To: jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, nathan@kernel.org, ndesaulniers@google.com, vinicius.gomes@intel.com, jeffrey.t.kirsher@intel.com Date: Sat, 14 Jan 2023 09:04:12 -0500 Message-Id: <20230114140412.3975245-1-trix@redhat.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673705071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6F2gTFb1ZrF9f6ES4DXTz8rBxEV3JQ1L7+17Uewwhrc=; b=f6E4aAZ43upnMNvNLM8psAAu4pkjwikN2oOWZN+XMta3PLQdQxHAIy7blst8g9vDdTkeyh Piu3n8JF8OB4sahwYAb0Nf5tCHVHFRNKlc5M/oCXXX7jq+fjnku3xw22nD/ya5ZFcAEEE0 dwA7wmTxwO3LeOSVka6bxL+rv0CQUMA= X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=f6E4aAZ4 Subject: [Intel-wired-lan] [PATCH] igc: return an error if the mac type is unknown in igc_ptp_systim_to_hwtstamp() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, llvm@lists.linux.dev, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, Tom Rix Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" clang static analysis reports drivers/net/ethernet/intel/igc/igc_ptp.c:673:3: warning: The left operand of '+' is a garbage value [core.UndefinedBinaryOperatorResult] ktime_add_ns(shhwtstamps.hwtstamp, adjust); ^ ~~~~~~~~~~~~~~~~~~~~ igc_ptp_systim_to_hwtstamp() silently returns without setting the hwtstamp if the mac type is unknown. This should be treated as an error. Fixes: 81b055205e8b ("igc: Add support for RX timestamping") Signed-off-by: Tom Rix --- drivers/net/ethernet/intel/igc/igc_ptp.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_ptp.c b/drivers/net/ethernet/intel/igc/igc_ptp.c index c34734d432e0..4e10ced736db 100644 --- a/drivers/net/ethernet/intel/igc/igc_ptp.c +++ b/drivers/net/ethernet/intel/igc/igc_ptp.c @@ -417,10 +417,12 @@ static int igc_ptp_verify_pin(struct ptp_clock_info *ptp, unsigned int pin, * * We need to convert the system time value stored in the RX/TXSTMP registers * into a hwtstamp which can be used by the upper level timestamping functions. + * + * Returns 0 on success. **/ -static void igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter, - struct skb_shared_hwtstamps *hwtstamps, - u64 systim) +static int igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter, + struct skb_shared_hwtstamps *hwtstamps, + u64 systim) { switch (adapter->hw.mac.type) { case igc_i225: @@ -430,8 +432,9 @@ static void igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter, systim & 0xFFFFFFFF); break; default: - break; + return -EINVAL; } + return 0; } /** @@ -652,7 +655,8 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter) regval = rd32(IGC_TXSTMPL); regval |= (u64)rd32(IGC_TXSTMPH) << 32; - igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval); + if (igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval)) + return; switch (adapter->link_speed) { case SPEED_10: -- 2.27.0 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan