diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c index 1da263676f2a..75f39e1f3ed1 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -690,12 +690,12 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *buffer, size_t length, kfree(in_data); return parse_retval; } - kfree(in_data); if (actual_length != length - status.count) { pr_err("%s: actual_length=%i expected=%li\n", __func__, actual_length, (long)(length - status.count)); ni_usb_dump_raw_block(in_data, usb_bytes_read); } + kfree(in_data); switch (status.error_code) { case NIUSB_NO_ERROR: retval = 0;