]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
staging: gpib: Change return type and error code of fluke_get_dma_residue
authorEverest K.C. <everestkc@everestkc.com.np>
Thu, 17 Oct 2024 09:25:10 +0000 (03:25 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 19 Oct 2024 08:00:42 +0000 (10:00 +0200)
fluke_get_dma_residue() returns unsigned int with -1 as error code.
This error cannot be caught.
Fix this by changing the return type of the function to int and
returning the error code, that was captured. Also, change the data
type of variable residue to int in the function fluke_dma_read().

Fixes: 55936779f496 ("staging: gpib: Add Fluke cda based cards GPIB driver")
Signed-off-by: Everest K.C. <everestkc@everestkc.com.np>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20241017092511.17621-1-everestkc@everestkc.com.np
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gpib/eastwood/fluke_gpib.c

index 651d73e1533a453a9febb4e328dcd1c184f472e2..b528405f33e0159604712e1fe8a2eb30c9331696 100644 (file)
@@ -537,7 +537,7 @@ static int fluke_accel_write(gpib_board_t *board, uint8_t *buffer, size_t length
        return 0;
 }
 
-static unsigned int fluke_get_dma_residue(struct dma_chan *chan, dma_cookie_t cookie)
+static int fluke_get_dma_residue(struct dma_chan *chan, dma_cookie_t cookie)
 {
        struct dma_tx_state state;
        int result;
@@ -545,7 +545,7 @@ static unsigned int fluke_get_dma_residue(struct dma_chan *chan, dma_cookie_t co
        result = dmaengine_pause(chan);
        if (result < 0) {
                pr_err("fluke_gpib: dma pause failed?\n");
-               return -1;
+               return result;
        }
        dmaengine_tx_status(chan, cookie, &state);
        // hardware doesn't support resume, so dont call this
@@ -560,7 +560,7 @@ static int fluke_dma_read(gpib_board_t *board, uint8_t *buffer,
        struct nec7210_priv *nec_priv = &e_priv->nec7210_priv;
        int retval = 0;
        unsigned long flags;
-       unsigned int residue;
+       int residue;
        dma_addr_t bus_address;
        struct dma_async_tx_descriptor *tx_desc;
        dma_cookie_t dma_cookie;