Commit 8c8b12a5 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Viresh Kumar
Browse files

rust: cpufreq: always inline functions using build_assert with arguments



`build_assert` relies on the compiler to optimize out its error path.
Functions using it with its arguments must thus always be inlined,
otherwise the error path of `build_assert` might not be optimized out,
triggering a build error.

Signed-off-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Reviewed-by: default avatarDaniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 7e3debb4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1015,6 +1015,8 @@ impl<T: Driver> Registration<T> {
        ..pin_init::zeroed()
    };

    // Always inline to optimize out error path of `build_assert`.
    #[inline(always)]
    const fn copy_name(name: &'static CStr) -> [c_char; CPUFREQ_NAME_LEN] {
        let src = name.to_bytes_with_nul();
        let mut dst = [0; CPUFREQ_NAME_LEN];