From patchwork Mon Sep 9 06:33:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Kleine-Budde X-Patchwork-Id: 13795936 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7168E1ACDF5 for ; Mon, 9 Sep 2024 06:37:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725863826; cv=none; b=ARjYyj7ZucKKP2I1gxMXWjvLY33CpHQPwXWK9S7UIvVnwU2MYMoGyuoYD+4V3P6sDEED1wOu9s/i9sXeTMgNtpner+DlIVnPELvGO9fUVqRC9krVttcOxXk4Cg/uDGsdxJGkqJZqbGHVkbWDsmUJX7/+qXC66TMV03QqQ38DvAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725863826; c=relaxed/simple; bh=A08C/9IMqoP0dQXOfqrdD1yWEXwhgu17+OLehaCLGd0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=asUJkiXVkzNDvzX1Rs933X9FsQHFg9xke6Rtfsq7oat/pR8CTuBBnaAr2QU0yVnua1JN8woPA/9EysRVeVaeHbyiqSgyAQC6S4m8uqOEcNZ6xlygtTYO1Zwp0G++inGCZXuEMzN0y+l5SF+XEFn0jjY/SuJGrf+Ut9iOWxYlAlM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1snY1G-0005wm-Ky for netdev@vger.kernel.org; Mon, 09 Sep 2024 08:37:02 +0200 Received: from [2a0a:edc0:0:b01:1d::7b] (helo=bjornoya.blackshift.org) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snY1G-006aXV-0r for netdev@vger.kernel.org; Mon, 09 Sep 2024 08:37:02 +0200 Received: from dspam.blackshift.org (localhost [127.0.0.1]) by bjornoya.blackshift.org (Postfix) with SMTP id AA7C9336453 for ; Mon, 09 Sep 2024 06:37:01 +0000 (UTC) Received: from hardanger.blackshift.org (unknown [172.20.34.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by bjornoya.blackshift.org (Postfix) with ESMTPS id 07C25336439; Mon, 09 Sep 2024 06:37:00 +0000 (UTC) Received: from blackshift.org (localhost [::1]) by hardanger.blackshift.org (OpenSMTPD) with ESMTP id f6428e02; Mon, 9 Sep 2024 06:36:59 +0000 (UTC) From: Marc Kleine-Budde To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org, kernel@pengutronix.de, "Rob Herring (Arm)" , Marc Kleine-Budde Subject: [PATCH net-next 1/3] net: can: cc770: Simplify parsing DT properties Date: Mon, 9 Sep 2024 08:33:53 +0200 Message-ID: <20240909063657.2287493-2-mkl@pengutronix.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240909063657.2287493-1-mkl@pengutronix.de> References: <20240909063657.2287493-1-mkl@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: "Rob Herring (Arm)" Use of the typed property accessors is preferred over of_get_property(). The existing code doesn't work on little endian systems either. Replace the of_get_property() calls with of_property_read_bool() and of_property_read_u32(). Signed-off-by: Rob Herring (Arm) Link: https://patch.msgid.link/20240903135731.405635-1-robh@kernel.org Signed-off-by: Marc Kleine-Budde --- drivers/net/can/cc770/cc770_platform.c | 30 +++++++++----------------- 1 file changed, 10 insertions(+), 20 deletions(-) base-commit: c259acab839e57eab0318f32da4ae803a8d59397 diff --git a/drivers/net/can/cc770/cc770_platform.c b/drivers/net/can/cc770/cc770_platform.c index 13bcfba05f18..f2424fe58612 100644 --- a/drivers/net/can/cc770/cc770_platform.c +++ b/drivers/net/can/cc770/cc770_platform.c @@ -70,17 +70,10 @@ static void cc770_platform_write_reg(const struct cc770_priv *priv, int reg, static int cc770_get_of_node_data(struct platform_device *pdev, struct cc770_priv *priv) { + u32 clkext = CC770_PLATFORM_CAN_CLOCK, clkout = 0; struct device_node *np = pdev->dev.of_node; - const u32 *prop; - int prop_size; - u32 clkext; - prop = of_get_property(np, "bosch,external-clock-frequency", - &prop_size); - if (prop && (prop_size == sizeof(u32))) - clkext = *prop; - else - clkext = CC770_PLATFORM_CAN_CLOCK; /* default */ + of_property_read_u32(np, "bosch,external-clock-frequency", &clkext); priv->can.clock.freq = clkext; /* The system clock may not exceed 10 MHz */ @@ -98,7 +91,7 @@ static int cc770_get_of_node_data(struct platform_device *pdev, if (of_property_read_bool(np, "bosch,iso-low-speed-mux")) priv->cpu_interface |= CPUIF_MUX; - if (!of_get_property(np, "bosch,no-comperator-bypass", NULL)) + if (!of_property_read_bool(np, "bosch,no-comperator-bypass")) priv->bus_config |= BUSCFG_CBY; if (of_property_read_bool(np, "bosch,disconnect-rx0-input")) priv->bus_config |= BUSCFG_DR0; @@ -109,25 +102,22 @@ static int cc770_get_of_node_data(struct platform_device *pdev, if (of_property_read_bool(np, "bosch,polarity-dominant")) priv->bus_config |= BUSCFG_POL; - prop = of_get_property(np, "bosch,clock-out-frequency", &prop_size); - if (prop && (prop_size == sizeof(u32)) && *prop > 0) { - u32 cdv = clkext / *prop; - int slew; + of_property_read_u32(np, "bosch,clock-out-frequency", &clkout); + if (clkout > 0) { + u32 cdv = clkext / clkout; if (cdv > 0 && cdv < 16) { + u32 slew; + priv->cpu_interface |= CPUIF_CEN; priv->clkout |= (cdv - 1) & CLKOUT_CD_MASK; - prop = of_get_property(np, "bosch,slew-rate", - &prop_size); - if (prop && (prop_size == sizeof(u32))) { - slew = *prop; - } else { + if (of_property_read_u32(np, "bosch,slew-rate", &slew)) { /* Determine default slew rate */ slew = (CLKOUT_SL_MASK >> CLKOUT_SL_SHIFT) - ((cdv * clkext - 1) / 8000000); - if (slew < 0) + if (slew > (CLKOUT_SL_MASK >> CLKOUT_SL_SHIFT)) slew = 0; } priv->clkout |= (slew << CLKOUT_SL_SHIFT) & From patchwork Mon Sep 9 06:33:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Kleine-Budde X-Patchwork-Id: 13795938 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 735001ACE0D for ; Mon, 9 Sep 2024 06:37:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725863827; cv=none; b=dPLY9gpTYa/IyKenav89KeHI4ipo9zHHLHqcmZ8dj84ZaVTiKWTK1giJQfi32mlKdewoECZv01g9j/raW98OtFb6QWQRhkJLaHI4agfuuZ88oWy378v1jJencyLI09sZcDgYVG8IkYlu/OfbIeuEq4dtg+a70FBmAjBQ+myMmGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725863827; c=relaxed/simple; bh=ESIdYawT6iTFsVfHEvwVsj4dazGHx82sjrfidJ5W/Ws=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sPE1coVNx7phtL4JxDIqlkuEIcXG56HB6myoj1AJZm/gc0Rsl4g+YZ1B5/92oihmev9Q+En4iSP2vghonmUkh9NIqcIWGqGqkf3w5W7BVOma+XDaKXXvW6yztRvsW2gKv3LnfaovypdbhUjjxNLFO0GLA9NIE2G2LeiVedi2E0I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1snY1G-0005wq-LU for netdev@vger.kernel.org; Mon, 09 Sep 2024 08:37:02 +0200 Received: from [2a0a:edc0:0:b01:1d::7b] (helo=bjornoya.blackshift.org) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snY1G-006aXd-4C for netdev@vger.kernel.org; Mon, 09 Sep 2024 08:37:02 +0200 Received: from dspam.blackshift.org (localhost [127.0.0.1]) by bjornoya.blackshift.org (Postfix) with SMTP id C2B31336454 for ; Mon, 09 Sep 2024 06:37:01 +0000 (UTC) Received: from hardanger.blackshift.org (unknown [172.20.34.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by bjornoya.blackshift.org (Postfix) with ESMTPS id 1CC4833643A; Mon, 09 Sep 2024 06:37:00 +0000 (UTC) Received: from blackshift.org (localhost [::1]) by hardanger.blackshift.org (OpenSMTPD) with ESMTP id b16b3ef0; Mon, 9 Sep 2024 06:36:59 +0000 (UTC) From: Marc Kleine-Budde To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org, kernel@pengutronix.de, Nathan Chancellor , Marc Kleine-Budde Subject: [PATCH net-next 2/3] can: rockchip_canfd: fix return type of rkcanfd_start_xmit() Date: Mon, 9 Sep 2024 08:33:54 +0200 Message-ID: <20240909063657.2287493-3-mkl@pengutronix.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240909063657.2287493-1-mkl@pengutronix.de> References: <20240909063657.2287493-1-mkl@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Nathan Chancellor With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A warning in clang aims to catch these at compile time, which reveals: drivers/net/can/rockchip/rockchip_canfd-core.c:770:20: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict] 770 | .ndo_start_xmit = rkcanfd_start_xmit, | ^~~~~~~~~~~~~~~~~~ ->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int' (although the types are ABI compatible). Adjust the return type of rkcanfd_start_xmit() to match the prototype's to resolve the warning. Fixes: ff60bfbaf67f ("can: rockchip_canfd: add driver for Rockchip CAN-FD controller") Signed-off-by: Nathan Chancellor Link: https://patch.msgid.link/20240906-rockchip-canfd-wifpts-v1-1-b1398da865b7@kernel.org Signed-off-by: Marc Kleine-Budde --- drivers/net/can/rockchip/rockchip_canfd-tx.c | 2 +- drivers/net/can/rockchip/rockchip_canfd.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/rockchip/rockchip_canfd-tx.c b/drivers/net/can/rockchip/rockchip_canfd-tx.c index f954f38b955f..865a15e033a9 100644 --- a/drivers/net/can/rockchip/rockchip_canfd-tx.c +++ b/drivers/net/can/rockchip/rockchip_canfd-tx.c @@ -63,7 +63,7 @@ void rkcanfd_xmit_retry(struct rkcanfd_priv *priv) rkcanfd_start_xmit_write_cmd(priv, reg_cmd); } -int rkcanfd_start_xmit(struct sk_buff *skb, struct net_device *ndev) +netdev_tx_t rkcanfd_start_xmit(struct sk_buff *skb, struct net_device *ndev) { struct rkcanfd_priv *priv = netdev_priv(ndev); u32 reg_frameinfo, reg_id, reg_cmd; diff --git a/drivers/net/can/rockchip/rockchip_canfd.h b/drivers/net/can/rockchip/rockchip_canfd.h index 3efd7f174e14..93131c7d7f54 100644 --- a/drivers/net/can/rockchip/rockchip_canfd.h +++ b/drivers/net/can/rockchip/rockchip_canfd.h @@ -546,7 +546,7 @@ void rkcanfd_timestamp_stop_sync(struct rkcanfd_priv *priv); unsigned int rkcanfd_get_effective_tx_free(const struct rkcanfd_priv *priv); void rkcanfd_xmit_retry(struct rkcanfd_priv *priv); -int rkcanfd_start_xmit(struct sk_buff *skb, struct net_device *ndev); +netdev_tx_t rkcanfd_start_xmit(struct sk_buff *skb, struct net_device *ndev); void rkcanfd_handle_tx_done_one(struct rkcanfd_priv *priv, const u32 ts, unsigned int *frame_len_p); From patchwork Mon Sep 9 06:33:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Kleine-Budde X-Patchwork-Id: 13795937 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8114E1AD3E0 for ; Mon, 9 Sep 2024 06:37:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725863826; cv=none; b=qszGgjZnyHFckvMeIkCQij8V2AU/d0pQ3AYig7yuGiJQaloqJvqqRWQFqc4uH10b86diq72uYMZcyGBlVL4RCXPjYDYww75k1jZ+GwSqXDLNJ/1qHZVBqBQowgbYqm1J8VB2T3LLPQmSES69rmdOaY2Cyr8GlA8/USwFD7xeKVM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725863826; c=relaxed/simple; bh=z3+Ly/FjeievgkLB7Q6V0xxEhP/+DbAG30rRW69OnMg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hx/QUD/F8LAn2axTkvi3T94Wi8+5dMEkQhPhSpk/GInFftPymok3Oir0zneDzmuTpAjSYoBFkEeSH3mNWcJropW/BnmHgRnKclLp3qISC74ZRpTMAbRKSb1lvKGVSttg2Z6yxsh4reHrh/Dz5jgCw5zHGoiq2L+GA2PiB5kCsMc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1snY1G-0005wr-PZ for netdev@vger.kernel.org; Mon, 09 Sep 2024 08:37:02 +0200 Received: from [2a0a:edc0:0:b01:1d::7b] (helo=bjornoya.blackshift.org) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snY1G-006aXe-4q for netdev@vger.kernel.org; Mon, 09 Sep 2024 08:37:02 +0200 Received: from dspam.blackshift.org (localhost [127.0.0.1]) by bjornoya.blackshift.org (Postfix) with SMTP id CDB7A336455 for ; Mon, 09 Sep 2024 06:37:01 +0000 (UTC) Received: from hardanger.blackshift.org (unknown [172.20.34.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by bjornoya.blackshift.org (Postfix) with ESMTPS id 34DDD33643C; Mon, 09 Sep 2024 06:37:00 +0000 (UTC) Received: from blackshift.org (localhost [::1]) by hardanger.blackshift.org (OpenSMTPD) with ESMTP id 09d1cf27; Mon, 9 Sep 2024 06:36:59 +0000 (UTC) From: Marc Kleine-Budde To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org, kernel@pengutronix.de, Marc Kleine-Budde , kernel test robot Subject: [PATCH net-next 3/3] can: rockchip_canfd: rkcanfd_timestamp_init(): fix 64 bit division on 32 bit platforms Date: Mon, 9 Sep 2024 08:33:55 +0200 Message-ID: <20240909063657.2287493-4-mkl@pengutronix.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240909063657.2287493-1-mkl@pengutronix.de> References: <20240909063657.2287493-1-mkl@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org On some 32-bit platforms (at least on parisc), the compiler generates a call to __divdi3() from the u32 by 3 division in rkcanfd_timestamp_init(), which results in the following linker error: | ERROR: modpost: "__divdi3" [drivers/net/can/rockchip/rockchip_canfd.ko] undefined! As this code doesn't run in the hot path, a 64 bit by 32 bit division is OK, even on 32 bit platforms. Use an explicit call to div_u64() to fix linking. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202409072304.lCQWyNLU-lkp@intel.com/ Link: https://patch.msgid.link/20240909-can-rockchip_canfd-fix-64-bit-division-v1-1-2748d9422b00@pengutronix.de Signed-off-by: Marc Kleine-Budde --- drivers/net/can/rockchip/rockchip_canfd-timestamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/rockchip/rockchip_canfd-timestamp.c b/drivers/net/can/rockchip/rockchip_canfd-timestamp.c index 81cccc5fd838..fb1a8f4e6217 100644 --- a/drivers/net/can/rockchip/rockchip_canfd-timestamp.c +++ b/drivers/net/can/rockchip/rockchip_canfd-timestamp.c @@ -71,7 +71,7 @@ void rkcanfd_timestamp_init(struct rkcanfd_priv *priv) max_cycles = div_u64(ULLONG_MAX, cc->mult); max_cycles = min(max_cycles, cc->mask); - work_delay_ns = clocksource_cyc2ns(max_cycles, cc->mult, cc->shift) / 3; + work_delay_ns = div_u64(clocksource_cyc2ns(max_cycles, cc->mult, cc->shift), 3); priv->work_delay_jiffies = nsecs_to_jiffies(work_delay_ns); INIT_DELAYED_WORK(&priv->timestamp, rkcanfd_timestamp_work);