Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp348207imw; Thu, 14 Jul 2022 02:26:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vYX1m7fUGZeem9iuU12h6z302BFth3OKwo4xaM+VA2KdGC5d9yFg8jb5p+GsBOGz5ZwcNq X-Received: by 2002:a17:906:20c6:b0:718:cc95:ccaf with SMTP id c6-20020a17090620c600b00718cc95ccafmr7918115ejc.714.1657790782993; Thu, 14 Jul 2022 02:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657790782; cv=none; d=google.com; s=arc-20160816; b=BInPe7nkGzYFN81hausFkNCgupEbosWONQZzXojfZa4D/BfS6BKGqRwXLgja1cogQF YnBcW017cdJCKENgNq5wTEDIybDFvti6lJD3LY9s55hNzGfVCmgh79CAXiPVTAFq8brc brsaMiv2ywxUAu1TvJQm1cmXjPCFQuHNBFfP8dntVdfHE7WI0LCrtu8jGpSqLrmyASd7 klGiOvPjTP3E7V0L+6yKAZ7ZICCdAZ45w3meZNIcV56jEJa7/V6gaYYlo90l5mVfKbfm mUGyZpQwsVHNPMpXlWXbv16dualnAUZb8tNoPaJ+Y+0nfmmOzr/+3FoFqUDvHESjkOvx I0RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=L7U+xNUa7u+4OWKfAhwvkxkgEoSFOdVNXwdOBUNhl9M=; b=02hCjCkP25hFsoDCLtY714sSlNrSgxanIhz2Pn5EVvZH+ZPKh6pbMNd/ETlQdKWoOb 2gb4Eqc/XQoP3JecRI/vnieXvNttFUzAd2jKK4F7ILQ4AS8Vdkt41hG+qh152o1ZCvbO GFFlBmWOzSkK9Ml6PmU3eS99SWzZ0f7+gBCqnJ9HyUvjaQ0pHWzA3eN3T8L+8MT12pA0 ZOygT/F9RiaJGkvoHKGSNl7nEORsiGeTTuwsWa/sPX9DbyuN2xji3vGs6dviM0h2tWcV 0XpNwZ5qEr8yIc3kHnrW8UGJ8JXVfgxYPvxHTMV/3PNiGsN36atJ0cRPzH/4NIHoRmAW cmNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Ol0ItgBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l23-20020a1709065a9700b0072b4d337f83si1127642ejq.837.2022.07.14.02.25.57; Thu, 14 Jul 2022 02:26:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Ol0ItgBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236570AbiGNInP (ORCPT + 99 others); Thu, 14 Jul 2022 04:43:15 -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-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: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 restricted __be16 drivers/net/ethernet/cadence/macb_main.c:3366:9: warning: cast from restricted __be16 drivers/net/ethernet/cadence/macb_main.c:3366:9: warning: cast from restricted __be16 drivers/net/ethernet/cadence/macb_main.c:3419:25: warning: cast from restricted __be16 drivers/net/ethernet/cadence/macb_main.c:3419:25: warning: cast from restricted __be16 drivers/net/ethernet/cadence/macb_main.c:3419:25: warning: cast from restricted __be16 drivers/net/ethernet/cadence/macb_main.c:3419:25: warning: cast from restricted __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/ethernet/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 *netdev, 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)); spin_lock_irqsave(&bp->rx_fs_lock, flags); @@ -3535,8 +3536,8 @@ static int gem_del_flow_filter(struct net_device *netdev, 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)); gem_writel_n(bp, SCRT2, fs->location, 0); -- 2.35.1