[PATCH -next 5/5] USB: usbip: Remove an unnecessary NULL value
shuah
shuah at kernel.org
Sat Aug 5 06:09:11 AEST 2023
On 8/4/23 03:32, Ruan Jinjie wrote:
> The NULL initialization of the pointers assigned by kzalloc() first is
> not necessary, because if the kzalloc() failed, the pointers will be
> assigned NULL, otherwise it works as usual. so remove it.
>
> Signed-off-by: Ruan Jinjie <ruanjinjie at huawei.com>
> ---
> drivers/usb/usbip/vudc_dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
> index 2bc428f2e261..8e42839e6060 100644
> --- a/drivers/usb/usbip/vudc_dev.c
> +++ b/drivers/usb/usbip/vudc_dev.c
> @@ -489,7 +489,7 @@ static void vudc_device_unusable(struct usbip_device *ud)
>
> struct vudc_device *alloc_vudc_device(int devid)
> {
> - struct vudc_device *udc_dev = NULL;
> + struct vudc_device *udc_dev;
>
> udc_dev = kzalloc(sizeof(*udc_dev), GFP_KERNEL);
> if (!udc_dev)
In addition to this, make a change to return NULL instead
of going to out.
if (!udc_dev)
goto out;
thanks,
-- Shuah
More information about the Linuxppc-dev
mailing list