Skip to content

Commit 4da3853

Browse files
dpenklergregkh
authored andcommitted
staging: gpib: Fix erroneous removal of blank before newline
The USB_GPIB_SET_LINES command string used to be: "\nIBDC \n" but when we were merging this code into the upstream kernel we deleted the space character before the newline to make checkpatch happy. That turned out to be a mistake. The "\nIBDC" part of the string is a command that we pass to the firmware and the next character is a variable u8 value. It gets set in set_control_line(). msg[leng - 2] = value ? (retval & ~line) : retval | line; where leng is the length of the command string. Imagine the parameter was supposed to be "8". With the pre-merge code the command string would be "\nIBDC8\n" With the post-merge code the command string became "\nIBD8\n" The firmware doesn't recognize "IBD8" as a valid command and rejects it. Putting a "." where the parameter is supposed to go fixes the driver and makes checkpatch happy. Same thing with the other define and the in-line assignment. Reported-by: Marcello Carla' <marcello.carla@gmx.com> Fixes: fce7951 ("staging: gpib: Add LPVO DIY USB GPIB driver") Co-developed-by: Marcello Carla' <marcello.carla@gmx.com> Signed-off-by: Marcello Carla' <marcello.carla@gmx.com> Signed-off-by: Dave Penkler <dpenkler@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241205093442.5796-1-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 78d4f34 commit 4da3853

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ module_param(debug, int, 0644);
9999
#define USB_GPIB_DEBUG_ON "\nIBDE\xAA\n"
100100
#define USB_GPIB_SET_LISTEN "\nIBDT0\n"
101101
#define USB_GPIB_SET_TALK "\nIBDT1\n"
102-
#define USB_GPIB_SET_LINES "\nIBDC\n"
103-
#define USB_GPIB_SET_DATA "\nIBDM\n"
102+
#define USB_GPIB_SET_LINES "\nIBDC.\n"
103+
#define USB_GPIB_SET_DATA "\nIBDM.\n"
104104
#define USB_GPIB_READ_LINES "\nIBD?C\n"
105105
#define USB_GPIB_READ_DATA "\nIBD?M\n"
106106
#define USB_GPIB_READ_BUS "\nIBD??\n"
@@ -589,7 +589,7 @@ static int usb_gpib_command(gpib_board_t *board,
589589
size_t *bytes_written)
590590
{
591591
int i, retval;
592-
char command[6] = "IBc\n";
592+
char command[6] = "IBc.\n";
593593

594594
DIA_LOG(1, "enter %p\n", board);
595595

0 commit comments

Comments
 (0)