From: Jouni Malinen Date: Tue, 18 Jul 2023 13:15:01 +0000 (+0300) Subject: P2P: Check p2p_channel_select() return value X-Git-Tag: hostap_2_11~1083 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50ee26fc7044ca38f0eecb59f7735caabdfd9553;p=thirdparty%2Fhostap.git P2P: Check p2p_channel_select() return value 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 --- diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 39af1b9bb..f6d92a390 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -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);