* [PATCH] USB: serial: Remove redundant NULL check before release_firmware() call
@ 2022-06-06 1:43 cgel.zte
2022-06-09 12:43 ` Johan Hovold
0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-06-06 1:43 UTC (permalink / raw)
To: johan; +Cc: gregkh, linux-usb, linux-kernel, Minghao Chi, Zeal Robot
From: Minghao Chi <chi.minghao@zte.com.cn>
release_firmware() checks for NULL pointers internally so checking
before calling it is redundant.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
drivers/usb/serial/mxuport.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c
index eb45a9b0005c..eb9090ab900f 100644
--- a/drivers/usb/serial/mxuport.c
+++ b/drivers/usb/serial/mxuport.c
@@ -1109,8 +1109,7 @@ static int mxuport_probe(struct usb_serial *serial,
*/
usb_set_serial_data(serial, (void *)id->driver_info);
out:
- if (fw_p)
- release_firmware(fw_p);
+ release_firmware(fw_p);
return err;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] USB: serial: Remove redundant NULL check before release_firmware() call
2022-06-06 1:43 [PATCH] USB: serial: Remove redundant NULL check before release_firmware() call cgel.zte
@ 2022-06-09 12:43 ` Johan Hovold
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2022-06-09 12:43 UTC (permalink / raw)
To: cgel.zte; +Cc: gregkh, linux-usb, linux-kernel, Minghao Chi, Zeal Robot
On Mon, Jun 06, 2022 at 01:43:15AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> release_firmware() checks for NULL pointers internally so checking
> before calling it is redundant.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
Cleanups do not deserve a Reported-by tag, and neither do reports that
are never posted to the mailing lists.
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
> drivers/usb/serial/mxuport.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c
> index eb45a9b0005c..eb9090ab900f 100644
> --- a/drivers/usb/serial/mxuport.c
> +++ b/drivers/usb/serial/mxuport.c
> @@ -1109,8 +1109,7 @@ static int mxuport_probe(struct usb_serial *serial,
> */
> usb_set_serial_data(serial, (void *)id->driver_info);
> out:
> - if (fw_p)
> - release_firmware(fw_p);
> + release_firmware(fw_p);
I think keeping this check is preferred here as it makes the intent of
code more clear (and you don't have to check the definition of
release_firmware() to make sure it's safe to pass in NULL).
> return err;
> }
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-09 12:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 1:43 [PATCH] USB: serial: Remove redundant NULL check before release_firmware() call cgel.zte
2022-06-09 12:43 ` Johan Hovold
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.