staging: wfx: simplify API coherency check
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Mon, 13 Sep 2021 13:01:43 +0000 (15:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Sep 2021 07:16:32 +0000 (09:16 +0200)
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 <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20210913130203.1903622-13-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/hif_tx.c

index 14b7e047916eb075565a410e45abd72cc0ca1b72..fcce78bb30050ba1b0aac9c4ecfa7419abdf4144 100644 (file)
@@ -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;