From: Shuah Khan <skhan@linuxfoundation.org>
To: "Everest K.C." <everestkc@everestkc.com.np>,
dpenkler@gmail.com, gregkh@linuxfoundation.org
Cc: dan.carpenter@linaro.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH V2] staging: gpib: Change return type and error code of fluke_get_dma_residue
Date: Thu, 17 Oct 2024 11:13:39 -0600 [thread overview]
Message-ID: <10af294f-97db-4af6-949d-8be778277157@linuxfoundation.org> (raw)
In-Reply-To: <20241017092511.17621-1-everestkc@everestkc.com.np>
On 10/17/24 03:25, Everest K.C. wrote:
> 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>
> ---
> V1 -> V2: - Fixed the caller
> - Updated the changelog
>
> drivers/staging/gpib/eastwood/fluke_gpib.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/gpib/eastwood/fluke_gpib.c b/drivers/staging/gpib/eastwood/fluke_gpib.c
> index f9f149db222d..378687eb619f 100644
> --- a/drivers/staging/gpib/eastwood/fluke_gpib.c
> +++ b/drivers/staging/gpib/eastwood/fluke_gpib.c
> @@ -536,7 +536,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;
> @@ -544,7 +544,7 @@ static unsigned int fluke_get_dma_residue(struct dma_chan *chan, dma_cookie_t co
> result = dmaengine_pause(chan);
As a side note, out of 21 dmaengine_pause() callers, just 3 check
the return value, spanning spi, stanging, tty, sound: core and soc
This exact same problem is in staging/gpib/fmh_gpib/fmh_gpib.c
unsigned int fmh_gpib_get_dma_residue() returns -1
> if (result < 0) {
> pr_err("fluke_gpib: dma pause failed?\n");
This could be a dev_err using dma_chan_dev
> - return -1;
> + return result;
> }
> dmaengine_tx_status(chan, cookie, &state);
> // hardware doesn't support resume, so dont call this
> @@ -559,7 +559,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;
Looks good to me.
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
thanks,
-- Shuah
next prev parent reply other threads:[~2024-10-17 17:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 9:25 [PATCH V2] staging: gpib: Change return type and error code of fluke_get_dma_residue Everest K.C.
2024-10-17 17:13 ` Shuah Khan [this message]
2024-10-17 19:02 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10af294f-97db-4af6-949d-8be778277157@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=dan.carpenter@linaro.org \
--cc=dpenkler@gmail.com \
--cc=everestkc@everestkc.com.np \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox