Re: [PATCH] staging: gpib: Fix memory leak in ni_usb_init()

From: Zilin Guan
Date: Mon Dec 29 2025 - 10:16:45 EST


On Mon, Dec 29, 2025 at 01:19:22PM+0100, Dave Penkler wrote:
> Good catch.
> Prefer simpler variant with check for failure first:
> if (!writes_len) {
> kfree(writes);
> return -EFAULT;
> }
> retval = ni_usb_write_registers(ni_priv, writes, writes_len, &ibsta);
> kfree(writes);
> if (retval) {
> ...
> cheers,
> -Dave

Thanks for the review and the suggestion. I will adopt this approach in v2.

Regards,
Zilin Guan