s390/hmcdrv: free memory on error path
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Mon, 19 Jan 2015 22:02:00 +0000 (23:02 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 22 Jan 2015 11:16:11 +0000 (12:16 +0100)
Free allocated page in case of error returned by hmcdrv_ftp_startup.

[heiko.carstens@de.ibm.com]: slightly changed Christophe's patch

Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/char/hmcdrv_ftp.c

index 4bd63322fc29e67987a2fd56afe8b73243ced37a..d4b61d9088fb731f504b83fb7aeb9b9ccc1b6fe5 100644 (file)
@@ -200,10 +200,9 @@ int hmcdrv_ftp_probe(void)
        rc = hmcdrv_ftp_startup();
 
        if (rc)
-               return rc;
+               goto out;
 
        rc = hmcdrv_ftp_do(&ftp);
-       free_page((unsigned long) ftp.buf);
        hmcdrv_ftp_shutdown();
 
        switch (rc) {
@@ -216,7 +215,8 @@ int hmcdrv_ftp_probe(void)
                        rc = 0; /* clear length (success) */
                break;
        } /* switch */
-
+out:
+       free_page((unsigned long) ftp.buf);
        return rc;
 }
 EXPORT_SYMBOL(hmcdrv_ftp_probe);