From nobody Sat Apr 18 10:53:35 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FB8BC43334 for ; Thu, 14 Jul 2022 08:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236702AbiGNInQ (ORCPT ); Thu, 14 Jul 2022 04:43:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229931AbiGNInL (ORCPT ); Thu, 14 Jul 2022 04:43:11 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E32B915707 for ; Thu, 14 Jul 2022 01:43:09 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id r2so562540wrs.3 for ; Thu, 14 Jul 2022 01:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=L7U+xNUa7u+4OWKfAhwvkxkgEoSFOdVNXwdOBUNhl9M=; b=Ol0ItgBra8CvmNJ8jpibH2QON11G0XMH7k85OKhvXYQAFNLhV4mCOt1WOaP9HCrm6X aXaxORtY99UXr/RHS6QGwCPBwfvUFbej/qYzLEaOVlwjXWntgymNa/Zlr7sccDiMpTp8 hC+ksv877LDHOn/OHjxeOIiw+ACYAZne2BM9L/VvpMhxCX6gcfllT48G63fFkTLoxGvS EBWjAPURzYow+FZXNB5ffS43M8cBTIKuQSrslzKJmKOEIle4EuBwmG0UuGHmO5B/KiAF L7KEhWopj3NJINDTYfOkuaGwgzruQ9Qykm0839QV4Ph6mZV2WR8q3h+ScyWhXONd/kMZ BSpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=L7U+xNUa7u+4OWKfAhwvkxkgEoSFOdVNXwdOBUNhl9M=; b=uIPvpBVGnngyLzmWcj8hRbyhumIjMXlLgb4N3DxO6lh27veYbCoI1MImA2InKs/++t TYALHAgfbgJCzcfEscEmZkg1dB0TziJTskw2jKTExi6/dB8RD2/eDZxp2w/4+HkyiF3y ODIltuGOjgT/JJFGYF5fYZljDIVg0gpdIq4ykIiyg/1J/OD/J1SKIPv+FnjLdsAa6/8o 89PIANv1xKgfm/vbD3tPreM9lnymvEGQZvb5OnJlgJNnLE6/V7T6jTxxE8FOT0Rnfwba 6E+vSmh9Tu2spP8hiuk9D7hA/S+wA86+4dmMBbWnHs66Pp2cRnFlkQu8XeeJWmqkCuyb vRIg== X-Gm-Message-State: AJIora8arnCgxsqIVBB2UOZxRaA7kygyXwlLEQZfT0+bbVpK32WlV8VO XmSCDG2Hk1FuBsXF8mOAYJ4vmxBxg2+24Ssk X-Google-Smtp-Source: AGRyM1sYkTZXv+De3e9zo8Nj/yFYsp5RvzWolKLhXIiGgbrZVWfwK6L6SoGF7mX0YdxWp9LmYPqwEg== X-Received: by 2002:a5d:4bc4:0:b0:21d:918c:b945 with SMTP id l4-20020a5d4bc4000000b0021d918cb945mr7040455wrt.287.1657788188298; Thu, 14 Jul 2022 01:43:08 -0700 (PDT) Received: from rainbowdash.office.codethink.co.uk ([167.98.27.226]) by smtp.gmail.com with ESMTPSA id i16-20020a5d5230000000b0021d9d13bf6csm854042wra.97.2022.07.14.01.43.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 01:43:07 -0700 (PDT) From: Ben Dooks To: linux-kernel@vger.kernel.org Cc: Sudip Mukherjee , Jude Onyenegecha , Nicolas Ferre , Claudiu Beznea , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, Ben Dooks Subject: [PATCH] net: macb: fixup sparse warnings on __be16 ports Date: Thu, 14 Jul 2022 09:43:05 +0100 Message-Id: <20220714084305.209425-1-ben.dooks@sifive.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The port fields in the ethool flow structures are defined to be __be16 types, so sparse is showing issues where these are being passed to htons(). Fix these warnings by passing them to be16_to_cpu() instead. These are being used in netdev_dbg() so should only effect anyone doing debug. Fixes the following sparse warnings: drivers/net/ethernet/cadence/macb_main.c:3366:9: warning: cast from restric= ted __be16 drivers/net/ethernet/cadence/macb_main.c:3366:9: warning: cast from restric= ted __be16 drivers/net/ethernet/cadence/macb_main.c:3366:9: warning: cast from restric= ted __be16 drivers/net/ethernet/cadence/macb_main.c:3419:25: warning: cast from restri= cted __be16 drivers/net/ethernet/cadence/macb_main.c:3419:25: warning: cast from restri= cted __be16 drivers/net/ethernet/cadence/macb_main.c:3419:25: warning: cast from restri= cted __be16 drivers/net/ethernet/cadence/macb_main.c:3419:25: warning: cast from restri= cted __be16 Signed-off-by: Ben Dooks -- Note, given the IP is also being passed ot htons() should this either be changed to be32_to_cpu() or better passed as a pointre and the %pI4 be used to print it. --- drivers/net/ethernet/cadence/macb_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index d89098f4ede8..f38b924e393b 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3482,7 +3482,8 @@ static int gem_add_flow_filter(struct net_device *net= dev, fs->flow_type, (int)fs->ring_cookie, fs->location, htonl(fs->h_u.tcp_ip4_spec.ip4src), htonl(fs->h_u.tcp_ip4_spec.ip4dst), - htons(fs->h_u.tcp_ip4_spec.psrc), htons(fs->h_u.tcp_ip4_spec.pdst)); + be16_to_cpu(fs->h_u.tcp_ip4_spec.psrc), + be16_to_cpu(fs->h_u.tcp_ip4_spec.pdst)); =20 spin_lock_irqsave(&bp->rx_fs_lock, flags); =20 @@ -3535,8 +3536,8 @@ static int gem_del_flow_filter(struct net_device *net= dev, fs->flow_type, (int)fs->ring_cookie, fs->location, htonl(fs->h_u.tcp_ip4_spec.ip4src), htonl(fs->h_u.tcp_ip4_spec.ip4dst), - htons(fs->h_u.tcp_ip4_spec.psrc), - htons(fs->h_u.tcp_ip4_spec.pdst)); + be16_to_cpu(fs->h_u.tcp_ip4_spec.psrc), + be16_to_cpu(fs->h_u.tcp_ip4_spec.pdst)); =20 gem_writel_n(bp, SCRT2, fs->location, 0); =20 --=20 2.35.1