* [PATCH] knownnetworks: update known frequencies maximum to 7115
@ 2022-03-03 17:22 James Prestwood
0 siblings, 0 replies; 4+ messages in thread
From: James Prestwood @ 2022-03-03 17:22 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 675 bytes --]
With the addition of 6GHz '6000' is no longer the maximum frequency
that could be in .known_network.freq.
---
src/knownnetworks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/knownnetworks.c b/src/knownnetworks.c
index 87df8b4d..fc024333 100644
--- a/src/knownnetworks.c
+++ b/src/knownnetworks.c
@@ -856,7 +856,7 @@ static struct l_queue *known_frequencies_from_string(char *freq_set_str)
t = strtoul(freq_set_str, &freq_set_str, 10);
- if (unlikely(errno == ERANGE || !t || t > 6000))
+ if (unlikely(errno == ERANGE || !t || t > 7115))
goto error;
known_freq = l_new(struct known_frequency, 1);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] knownnetworks: update known frequencies maximum to 7115
@ 2022-03-03 17:59 Diederik de Haas
0 siblings, 0 replies; 4+ messages in thread
From: Diederik de Haas @ 2022-03-03 17:59 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 436 bytes --]
On Thursday, 3 March 2022 18:22:34 CET James Prestwood wrote:
> - if (unlikely(errno == ERANGE || !t || t > 6000))
> + if (unlikely(errno == ERANGE || !t || t > 7115))
Sorry if this is a dumb comment, but why use a 'magic number' [1] (which
meaning can be derived from the git commit comment, but not when just looking
at the source)?
1) https://en.wikipedia.org/wiki/Magic_number_(programming)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] knownnetworks: update known frequencies maximum to 7115
@ 2022-03-03 18:57 Denis Kenzior
0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2022-03-03 18:57 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 881 bytes --]
Hi James,
On 3/3/22 11:22, James Prestwood wrote:
> With the addition of 6GHz '6000' is no longer the maximum frequency
> that could be in .known_network.freq.
> ---
> src/knownnetworks.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/knownnetworks.c b/src/knownnetworks.c
> index 87df8b4d..fc024333 100644
> --- a/src/knownnetworks.c
> +++ b/src/knownnetworks.c
> @@ -856,7 +856,7 @@ static struct l_queue *known_frequencies_from_string(char *freq_set_str)
>
> t = strtoul(freq_set_str, &freq_set_str, 10);
>
> - if (unlikely(errno == ERANGE || !t || t > 6000))
> + if (unlikely(errno == ERANGE || !t || t > 7115))
Do you want to use band_freq_to_channel here instead? That one checks the valid
freqs...
> goto error;
>
> known_freq = l_new(struct known_frequency, 1);
>
Regards,
-Denis
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] knownnetworks: update known frequencies maximum to 7115
@ 2022-03-03 20:23 James Prestwood
0 siblings, 0 replies; 4+ messages in thread
From: James Prestwood @ 2022-03-03 20:23 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 857 bytes --]
On Thu, 2022-03-03 at 18:59 +0100, Diederik de Haas wrote:
> On Thursday, 3 March 2022 18:22:34 CET James Prestwood wrote:
> > - if (unlikely(errno == ERANGE || !t || t > 6000))
> > + if (unlikely(errno == ERANGE || !t || t > 7115))
>
> Sorry if this is a dumb comment, but why use a 'magic number' [1]
> (which
> meaning can be derived from the git commit comment, but not when just
> looking
> at the source)?
I'm not sure if we have a style/rule about this but I think generally
if the value is only used once, and its clear what it is, a macro may
not be required.
*waits for angry mob*
Denis' recommendation solves a few potential issues in addition to just
updating, including the hard coded value.
>
> 1) https://en.wikipedia.org/wiki/Magic_number_(programming)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-03 20:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-03 18:57 [PATCH] knownnetworks: update known frequencies maximum to 7115 Denis Kenzior
-- strict thread matches above, loose matches on Subject: below --
2022-03-03 20:23 James Prestwood
2022-03-03 17:59 Diederik de Haas
2022-03-03 17:22 James Prestwood
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.