]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Check p2p_channel_select() return value
authorJouni Malinen <quic_jouni@quicinc.com>
Tue, 18 Jul 2023 13:15:01 +0000 (16:15 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 18 Jul 2023 13:15:01 +0000 (16:15 +0300)
Verify that the operation succeeds before a debug print indicating that
it did. This was already done in most callers, so be more consistent and
do it here as well.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/p2p/p2p.c

index 39af1b9bb0e92bc3e6ea908fc2dbf861e95df9ed..f6d92a390a852999c8b3ad6952987eb1d2da2ba3 100644 (file)
@@ -1499,11 +1499,12 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
        } else {
                /* Select any random available channel from the first available
                 * operating class */
-               p2p_channel_select(&p2p->cfg->channels, NULL,
-                                  &p2p->op_reg_class,
-                                  &p2p->op_channel);
-               p2p_dbg(p2p, "Select random available channel %d from operating class %d as operating channel preference",
-                       p2p->op_channel, p2p->op_reg_class);
+               if (p2p_channel_select(&p2p->cfg->channels, NULL,
+                                      &p2p->op_reg_class,
+                                      &p2p->op_channel) == 0)
+                       p2p_dbg(p2p,
+                               "Select random available channel %d from operating class %d as operating channel preference",
+                               p2p->op_channel, p2p->op_reg_class);
        }
 
        p2p_copy_channels(&p2p->channels, &p2p->cfg->channels, p2p->allow_6ghz);