staging: vc04_services: vchiq_bus: Do not kfree device
authorUmang Jain <umang.jain@ideasonboard.com>
Wed, 18 Oct 2023 05:52:28 +0000 (11:22 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Oct 2023 09:55:23 +0000 (11:55 +0200)
As per device_register() documentation, this kfree() on error path will
crash. The call to put_device() is all that is needed here to free the
memory.

Fixes: 027e5703de6b ("staging: vc04_services: vchiq_arm: Add new bus type and device type")
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/20231018055228.825524-1-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c

index 4ac3491efe45a02d67e0e2c0a24b2829fe3c1dd6..0076d091b9b2893e1f8a45cc9298b7f536062937 100644 (file)
@@ -73,7 +73,6 @@ vchiq_device_register(struct device *parent, const char *name)
        if (ret) {
                dev_err(parent, "Cannot register %s: %d\n", name, ret);
                put_device(&device->dev);
-               kfree(device);
                return NULL;
        }