staging: r8188eu: Hal_MappingOutPipe should return an int
authorMartin Kaiser <martin@kaiser.cx>
Sat, 6 Aug 2022 19:55:28 +0000 (21:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Aug 2022 13:17:57 +0000 (15:17 +0200)
Update the Hal_MappingOutPipe function to return 0 for success or -EXNIO
if the caller requested more than the number of available endpoints.
This error code is also used by usb_find_common_endpoints if a requested
endpoint was not found.

Unlike a boolean return value, a negative error code can be returned to
external functions that call the r8188eu driver, e.g. to the caller of our
probe function.

HalUsbSetQueuePipeMapping8188EUsb passes the return value of
Hal_MappingOutPipe on to its caller. We have to change its return type
from bool to int as well.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220806195540.777390-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/hal/hal_com.c
drivers/staging/r8188eu/hal/usb_halinit.c
drivers/staging/r8188eu/include/hal_com.h

index 6a1cdc67335b37ea8b21b31458c4c2e2e4649f09..d24e0e5924ebaf24ce218e1a96245938887317d3 100644 (file)
@@ -225,11 +225,10 @@ static void three_out_pipe(struct adapter *adapter, bool wifi_cfg)
        }
 }
 
-bool Hal_MappingOutPipe(struct adapter *adapter, u8 numoutpipe)
+int Hal_MappingOutPipe(struct adapter *adapter, u8 numoutpipe)
 {
        struct registry_priv *pregistrypriv = &adapter->registrypriv;
        bool wifi_cfg = pregistrypriv->wifi_spec;
-       bool result = true;
 
        switch (numoutpipe) {
        case 2:
@@ -242,10 +241,9 @@ bool Hal_MappingOutPipe(struct adapter *adapter, u8 numoutpipe)
                one_out_pipe(adapter);
                break;
        default:
-               result = false;
-               break;
+               return -ENXIO;
        }
-       return result;
+       return 0;
 }
 
 /*
index 8b36fb56076e4ae98999585578867fac5e66b732..ba068e6fd9fb25846bead8b91a388876baa83c6f 100644 (file)
@@ -35,7 +35,7 @@ static void _ConfigNormalChipOutEP_8188E(struct adapter *adapt, u8 NumOutPipe)
        }
 }
 
-static bool HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumOutPipe)
+static int HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumOutPipe)
 {
 
        _ConfigNormalChipOutEP_8188E(adapt, NumOutPipe);
index d7e333f6ce39b3abe4a294dbc7633b199fd0e0ee..3dfb61e64ee001620268d8f3be785e9d878547e5 100644 (file)
@@ -143,7 +143,7 @@ u8 MRateToHwRate(u8 rate);
 
 void HalSetBrateCfg(struct adapter *Adapter, u8 *mBratesOS, u16 *pBrateCfg);
 
-bool Hal_MappingOutPipe(struct adapter *pAdapter, u8 NumOutPipe);
+int Hal_MappingOutPipe(struct adapter *pAdapter, u8 NumOutPipe);
 
 s32 c2h_evt_read(struct adapter *adapter, u8 *buf);