| ed375186 | 25-Feb-2025 |
Rodrigo Gobbi <[email protected]> |
staging: gpib: change return type of t1_delay function to report errors
The current code returns "unsigned int" and it doesn't handle errors correctly if it happens during ioctl call for t1 delay co
staging: gpib: change return type of t1_delay function to report errors
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| 3e2bcc16 | 14-Jan-2025 |
Dave Penkler <[email protected]> |
staging: gpib: Use C99 syntax and make static
Some drivers were still using the old syntax for initializing structs: field : value;
This caused sparse to emit the following warning, for example: co
staging: gpib: Use C99 syntax and make static
Some drivers were still using the old syntax for initializing structs: field : value;
This caused sparse to emit the following warning, for example: common/gpib_os.c:2026:1: warning: obsolete struct initializer, use C99 syntax
Use C99 syntax: .field = value;
Some local structs and arrays were not declared static causing sparse to emit the following warning, for example: warning: symbol 'ib_fops' was not declared. Should it be static?
Declare the local structs and arrays as static.
Signed-off-by: Dave Penkler <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| 3c2ae0cb | 04-Nov-2024 |
Dave Penkler <[email protected]> |
staging: gpib: Re-order the lookup tables
Re-order the tables so that the bcm27xx table is used first as these devices are more popular and numerous than the older ones. This is slightly more effici
staging: gpib: Re-order the lookup tables
Re-order the tables so that the bcm27xx table is used first as these devices are more popular and numerous than the older ones. This is slightly more efficient for the later pi3 and subsequent models but should not be noticable in practice for all users.
Signed-off-by: Dave Penkler <[email protected]> Reviewed-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|