]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
cw1200: Fix a signedness bug in cw1200_load_firmware()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 1 Oct 2019 11:45:01 +0000 (14:45 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 2 Oct 2019 04:34:51 +0000 (07:34 +0300)
The "priv->hw_type" is an enum and in this context GCC will treat it
as an unsigned int so the error handling will never trigger.

Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/st/cw1200/fwio.c

index 6574e78e05eae4b88ffc56a6f22f6378021c5e56..2a03dc533b6aa581777cc3b06c7129f77466042f 100644 (file)
@@ -320,12 +320,12 @@ int cw1200_load_firmware(struct cw1200_common *priv)
                goto out;
        }
 
-       priv->hw_type = cw1200_get_hw_type(val32, &major_revision);
-       if (priv->hw_type < 0) {
+       ret = cw1200_get_hw_type(val32, &major_revision);
+       if (ret < 0) {
                pr_err("Can't deduce hardware type.\n");
-               ret = -ENOTSUPP;
                goto out;
        }
+       priv->hw_type = ret;
 
        /* Set DPLL Reg value, and read back to confirm writes work */
        ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID,