USB: misc: Remove unnecessary NULL values
authorRuan Jinjie <ruanjinjie@huawei.com>
Fri, 4 Aug 2023 09:32:50 +0000 (17:32 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Aug 2023 12:48:55 +0000 (14:48 +0200)
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@huawei.com>
Link: https://lore.kernel.org/r/20230804093253.91647-3-ruanjinjie@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/misc/cypress_cy7c63.c
drivers/usb/misc/cytherm.c
drivers/usb/misc/usbsevseg.c

index 14faec51d7a5d7041b4d72b9d5da91b0c8d10f51..cecd7693b7413c10814b8bf2432ebb3db984bcbe 100644 (file)
@@ -203,7 +203,7 @@ ATTRIBUTE_GROUPS(cypress);
 static int cypress_probe(struct usb_interface *interface,
                         const struct usb_device_id *id)
 {
-       struct cypress *dev = NULL;
+       struct cypress *dev;
        int retval = -ENOMEM;
 
        /* allocate memory for our device state and initialize it */
index 9504178f5c89c742a641a7666b2d7e6282b329fc..875016dd073c2f67a35bcd5d1f1ec8350e1935ca 100644 (file)
@@ -304,7 +304,7 @@ static int cytherm_probe(struct usb_interface *interface,
                         const struct usb_device_id *id)
 {
        struct usb_device *udev = interface_to_usbdev(interface);
-       struct usb_cytherm *dev = NULL;
+       struct usb_cytherm *dev;
        int retval = -ENOMEM;
 
        dev = kzalloc(sizeof(struct usb_cytherm), GFP_KERNEL);
index c3114d9bd1287a29edc222501aecb331e57aacdd..546deff754ba2adcfd5c513d08f8deb48a03875e 100644 (file)
@@ -305,7 +305,7 @@ static int sevseg_probe(struct usb_interface *interface,
        const struct usb_device_id *id)
 {
        struct usb_device *udev = interface_to_usbdev(interface);
-       struct usb_sevsegdev *mydev = NULL;
+       struct usb_sevsegdev *mydev;
        int rc = -ENOMEM;
 
        mydev = kzalloc(sizeof(struct usb_sevsegdev), GFP_KERNEL);