drivers/net/ethernet/realtek/rtase/rtase_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Use min() instead of min_t() to avoid the possibility of casting to the
wrong type.
Fixes: a36e9f5cfe9e ("rtase: Add support for a pci table in this module")
Signed-off-by: Justin Lai <justinlai0215@realtek.com>
---
drivers/net/ethernet/realtek/rtase/rtase_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c
index 6251548d50ff..8c902eaeb5ec 100644
--- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
+++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
@@ -1983,7 +1983,7 @@ static u16 rtase_calc_time_mitigation(u32 time_us)
u8 msb, time_count, time_unit;
u16 int_miti;
- time_us = min_t(int, time_us, RTASE_MITI_MAX_TIME);
+ time_us = min(time_us, RTASE_MITI_MAX_TIME);
msb = fls(time_us);
if (msb >= RTASE_MITI_COUNT_BIT_NUM) {
@@ -2005,7 +2005,7 @@ static u16 rtase_calc_packet_num_mitigation(u16 pkt_num)
u8 msb, pkt_num_count, pkt_num_unit;
u16 int_miti;
- pkt_num = min_t(int, pkt_num, RTASE_MITI_MAX_PKT_NUM);
+ pkt_num = min(pkt_num, RTASE_MITI_MAX_PKT_NUM);
if (pkt_num > 60) {
pkt_num_unit = RTASE_MITI_MAX_PKT_NUM_IDX;
--
2.34.1
On Thu, Apr 24, 2025 at 02:21:45PM +0800, Justin Lai wrote:
> Use min() instead of min_t() to avoid the possibility of casting to the
> wrong type.
>
> Fixes: a36e9f5cfe9e ("rtase: Add support for a pci table in this module")
> Signed-off-by: Justin Lai <justinlai0215@realtek.com>
> ---
> drivers/net/ethernet/realtek/rtase/rtase_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> index 6251548d50ff..8c902eaeb5ec 100644
> --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
> +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> @@ -1983,7 +1983,7 @@ static u16 rtase_calc_time_mitigation(u32 time_us)
> u8 msb, time_count, time_unit;
> u16 int_miti;
>
> - time_us = min_t(int, time_us, RTASE_MITI_MAX_TIME);
> + time_us = min(time_us, RTASE_MITI_MAX_TIME);
>
> msb = fls(time_us);
> if (msb >= RTASE_MITI_COUNT_BIT_NUM) {
> @@ -2005,7 +2005,7 @@ static u16 rtase_calc_packet_num_mitigation(u16 pkt_num)
> u8 msb, pkt_num_count, pkt_num_unit;
> u16 int_miti;
>
> - pkt_num = min_t(int, pkt_num, RTASE_MITI_MAX_PKT_NUM);
> + pkt_num = min(pkt_num, RTASE_MITI_MAX_PKT_NUM);
>
> if (pkt_num > 60) {
> pkt_num_unit = RTASE_MITI_MAX_PKT_NUM_IDX;
This looks fine to me and the patch is against net-next according to
the subject line (I think?).
I suppose there might be the question of whether this should go
against net (because it has a fixes), but my vote is that this is
cleanup and should go in net-next as titled.
Unless you've seen a bug around this and it should be against net
instead?
I don't know, but I think it is unlikely there would be a bug in the
wild because:
- RTASE_MITI_DEFAULT_TIME (128)
- RTASE_MITI_DEFAULT_PKT_NUM (64)
- RTASE_MITI_MAX_TIME (491520)
- RTASE_MITI_MAX_PKT_NUM (240)
all seem to fit in an int, so I think this change is probably more
of a cleanup than a fixes ?
All that said:
Reviewed-by: Joe Damato <jdamato@fastly.com>
On Thu, 24 Apr 2025 09:58:31 -0700 Joe Damato wrote: > This looks fine to me and the patch is against net-next according to > the subject line (I think?). Agreed, Justin please repost this and the next patch without the Fixes tags. The fixes tag is used for backporting in the stable tree. This commit will not be backported. -- pw-bot: cr
> On Thu, 24 Apr 2025 09:58:31 -0700 Joe Damato wrote: > > This looks fine to me and the patch is against net-next according to > > the subject line (I think?). > > Agreed, Justin please repost this and the next patch without the Fixes tags. The > fixes tag is used for backporting in the stable tree. > This commit will not be backported. > -- > pw-bot: cr Hi Jakub, Joe, Thank you for your reply. I will remove the Fixes tag from both patches and repost them. Thanks, Justin
© 2016 - 2026 Red Hat, Inc.