OSDN Git Service

staging: wlan-ng: small cleanup in writeimage()
authorArchana <craechal@gmail.com>
Sat, 11 Mar 2023 12:12:52 +0000 (12:12 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Mar 2023 08:43:42 +0000 (09:43 +0100)
It is cleaner to use "goto free_result;" as is being followed
in rest of the implementation of writeimage function, and
remove unnecessary kfree statements.

Signed-off-by: Archana <craechal@gmail.com>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/20230311121253.10225-1-craechal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wlan-ng/prism2fw.c

index 02a2191..98ed9bb 100644 (file)
@@ -1008,12 +1008,11 @@ static int writeimage(struct wlandevice *wlandev, struct imgchunk *fchunk,
        rstmsg = kzalloc(sizeof(*rstmsg), GFP_KERNEL);
        rwrmsg = kzalloc(sizeof(*rwrmsg), GFP_KERNEL);
        if (!rstmsg || !rwrmsg) {
-               kfree(rstmsg);
-               kfree(rwrmsg);
                netdev_err(wlandev->netdev,
                           "%s: no memory for firmware download, aborting download\n",
                           __func__);
-               return -ENOMEM;
+               result = -ENOMEM;
+               goto free_result;
        }
 
        /* Initialize the messages */