The function uses goto free_result in rest of its implementation. Signed-off-by: Archana <craechal@xxxxxxxxx> --- drivers/staging/wlan-ng/prism2fw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c index 02a2191d5c4d..98ed9bb9192c 100644 --- a/drivers/staging/wlan-ng/prism2fw.c +++ b/drivers/staging/wlan-ng/prism2fw.c @@ -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 */ -- 2.34.1