From 50ee26fc7044ca38f0eecb59f7735caabdfd9553 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 18 Jul 2023 16:15:01 +0300 Subject: [PATCH] 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 --- src/p2p/p2p.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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); -- 2.47.2