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 <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2023-07-18 16:15:01 +03:00 committed by Jouni Malinen
parent fb2b7858a7
commit 50ee26fc70

View 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);