ath10k-ct: Fix spectral scan NULL pointer
[openwrt/openwrt.git] / package / kernel / ath10k-ct / patches / 300-ath10k-ct-Fix-spectral-scan-NULL-pointer.patch
1 From 0d2e335d780bda1432a9ba719c8200f796d27854 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Mon, 29 Nov 2021 12:27:12 +0100
4 Subject: [PATCH] ath10k-ct: Fix spectral scan NULL pointer
5
6 If spectral scan support is enabled then ath10k-ct will cause a NULL
7 pointer due to relay_open() being called with a const callback struct
8 which is only supported in kernel 5.11 and later.
9
10 So, simply check the kernel version and if 5.11 and newer use the const
11 callback struct, otherwise use the regular struct.
12
13 Fixes: 553a3ac ("ath10k-ct: use 5.15 version")
14 Signed-off-by: Robert Marko <robimarko@gmail.com>
15 ---
16 ath10k-5.15/spectral.c | 4 ++++
17 1 file changed, 4 insertions(+)
18
19 --- a/ath10k-5.15/spectral.c
20 +++ b/ath10k-5.15/spectral.c
21 @@ -497,7 +497,11 @@ static int remove_buf_file_handler(struc
22 return 0;
23 }
24
25 +#if LINUX_VERSION_IS_GEQ(5,11,0)
26 static const struct rchan_callbacks rfs_spec_scan_cb = {
27 +#else
28 +static struct rchan_callbacks rfs_spec_scan_cb = {
29 +#endif
30 .create_buf_file = create_buf_file_handler,
31 .remove_buf_file = remove_buf_file_handler,
32 };