From 2ac7521bf99ce118c66e359bde5d40fea2730f15 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Pouiller?= Date: Mon, 13 Sep 2021 15:01:43 +0200 Subject: [PATCH] staging: wfx: simplify API coherency check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The 'channel' argument of hif_join() should never be NULL. hif_join() does not have the responsibility to recover bug of caller. In current code, if the argument channel is NULL, memory leaks. The new code just emit a warning and does not give the illusion that it is supported (and indeed a Oops will probably raise a few lines below). Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20210913130203.1903622-13-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_tx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 14b7e047916eb..fcce78bb30050 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -301,8 +301,6 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, WARN_ON(!conf->basic_rates); WARN_ON(sizeof(body->ssid) < ssidlen); WARN(!conf->ibss_joined && !ssidlen, "joining an unknown BSS"); - if (WARN_ON(!channel)) - return -EINVAL; if (!hif) return -ENOMEM; body->infrastructure_bss_mode = !conf->ibss_joined; -- 2.30.2