public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com>
Cc: gregkh@linuxfoundation.org, dpenkler@gmail.com,
	~lkcamp/patches@lists.sr.ht, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: gpib: change return type of t1_delay function to report errors
Date: Tue, 18 Feb 2025 10:49:50 +0300	[thread overview]
Message-ID: <5ee5bdfc-1e5b-4fe5-9794-a22175bd845e@stanley.mountain> (raw)
In-Reply-To: <20250218021804.29016-1-rodrigo.gobbi.7@gmail.com>

On Mon, Feb 17, 2025 at 11:12:54PM -0300, Rodrigo Gobbi wrote:
> The current code returns "unsigned int" and it doesn't handle errors
> correctly if it happens during ioctl call for t1 delay configuration.
> 
> The ni_usb_t1_delay(), from NI, is the only function returning -1
> at this point. The caller, t1_delay_ioctl(), doesn't check for errors
> and sets board->t1_nano_sec to -1 and returns success.
> The board->t1_nano_sec value is also used in ni_usb_setup_t1_delay()
> besides the ioctl call and a value of -1 is treated as being above 1100ns.
> It may or may not have a noticeable effect, but it's obviously not right
> considering the content of ni_usb_setup_t1_delay().
> 
> Typical delays are in the 200-2000 range, but definitely not more
> than INT_MAX so we can fix this code by changing the return type to int
> and adding a check for errors. While we're at it, lets change the error
> code in ni_usb_t1_delay() from -1 and instead propagate the error from
> ni_usb_write_registers().
> 
> Fixes: 4e127de14fa7 ("staging: gpib: Add National Instruments USB GPIB driver")
> Signed-off-by: Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com>
> ---
> Changelog:
> v2: merge patchset into one commit; 
>     minor change at return statement;
> 	improve commit msg as suggested by Dan;
> v1: https://lore.kernel.org/linux-staging/20250212024247.176572-1-rodrigo.gobbi.7@gmail.com/

Thank you!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


  reply	other threads:[~2025-02-18  7:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18  2:12 [PATCH v2] staging: gpib: change return type of t1_delay function to report errors Rodrigo Gobbi
2025-02-18  7:49 ` Dan Carpenter [this message]
2025-02-19 15:52 ` Greg KH
2025-03-11 23:25   ` Rodrigo Gobbi

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=5ee5bdfc-1e5b-4fe5-9794-a22175bd845e@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=dpenkler@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=rodrigo.gobbi.7@gmail.com \
    --cc=~lkcamp/patches@lists.sr.ht \
    /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