[bug report] wifi: ath12k: unnecessary div_u64()

Dan Carpenter error27 at gmail.com
Thu Feb 16 06:00:55 PST 2023


Hello Kalle Valo,

The patch d889913205cf: "wifi: ath12k: driver for Qualcomm Wi-Fi 7
devices" from Nov 28, 2022, leads to the following Smatch static
checker warning:

drivers/net/wireless/ath/ath12k/wmi.c:5857 ath12k_chan_info_event() warn: div_u64() expects 'ullong' got 'uint'
drivers/net/wireless/ath/ath12k/wmi.c:5858 ath12k_chan_info_event() warn: div_u64() expects 'ullong' got 'uint'

drivers/net/wireless/ath/ath12k/wmi.c
    5851         if (ch_info_ev.cmd_flags == WMI_CHAN_INFO_START_RESP) {
    5852                 survey = &ar->survey[idx];
    5853                 memset(survey, 0, sizeof(*survey));
    5854                 survey->noise = le32_to_cpu(ch_info_ev.noise_floor);
    5855                 survey->filled = SURVEY_INFO_NOISE_DBM | SURVEY_INFO_TIME |
    5856                                  SURVEY_INFO_TIME_BUSY;
--> 5857                 survey->time = div_u64(le32_to_cpu(ch_info_ev.cycle_count), cc_freq_hz);
    5858                 survey->time_busy = div_u64(le32_to_cpu(ch_info_ev.rx_clear_count),
    5859                                             cc_freq_hz);

What's the point of using div_u64() on u32 variables?

    5860         }
    5861 exit:
    5862         spin_unlock_bh(&ar->data_lock);
    5863         rcu_read_unlock();
    5864 }

regards,
dan carpenter



More information about the ath12k mailing list