lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1287125845-12825-2-git-send-email-marek.belisko@gmail.com>
Date:	Fri, 15 Oct 2010 08:57:25 +0200
From:	Marek Belisko <marek.belisko@...il.com>
To:	Greg Kroah-Hartman <gregkh@...e.de>,
	Marek Belisko <marek.belisko@...il.com>,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Cc:	Marek Belisko <marek.belisko@...il.com>
Subject: [PATCH 2/2] staging:ft1000: Use specific return error codes.

Signed-off-by: Marek Belisko <marek.belisko@...il.com>
---
 drivers/staging/ft1000/ft1000-usb/ft1000_hw.c |   30 ++++++++++++++----------
 1 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 8498538..a218455 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -961,7 +961,7 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev)
     if (!netdev )
     {
         DEBUG("init_ft1000_netdev: can not allocate network device\n");
-        return STATUS_FAILURE;
+	return -ENOMEM;
     }
 
     //pInfo = (PFT1000_INFO)netdev->priv;
@@ -984,8 +984,7 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev)
 		ret_val = strict_strtoul(card_nr, 10, &gCardIndex);
 		if (ret_val) {
 			printk(KERN_ERR "Can't parse netdev\n");
-			free_netdev(netdev);
-			return STATUS_FAILURE;
+			goto err_net;
 		}
 
             pInfo->CardNumber = gCardIndex;
@@ -993,8 +992,8 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev)
         }
         else {
             printk(KERN_ERR "ft1000: Invalid device name\n");
-	    free_netdev(netdev);
-            return STATUS_FAILURE;
+		ret_val = -ENXIO;
+		goto err_net;
         }
     }
     else
@@ -1065,21 +1064,24 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev)
         for (i=0; i<NUM_OF_FREE_BUFFERS; i++) {
             // Get memory for DPRAM_DATA link list
             pdpram_blk = kmalloc ( sizeof(DPRAM_BLK), GFP_KERNEL );
-	    if (pdpram_blk == NULL)
-		goto err_free;
+		if (pdpram_blk == NULL) {
+			ret_val = -ENOMEM;
+			goto err_free;
+		}
             // Get a block of memory to store command data
             pdpram_blk->pbuffer = kmalloc ( MAX_CMD_SQSIZE, GFP_KERNEL );
-	    if (pdpram_blk->pbuffer == NULL) {
-		kfree(pdpram_blk);
-		goto err_free;
-	    }
+		if (pdpram_blk->pbuffer == NULL) {
+			ret_val = -ENOMEM;
+			kfree(pdpram_blk);
+			goto err_free;
+		}
             // link provisioning data
             list_add_tail (&pdpram_blk->list, &freercvpool);
         }
         numofmsgbuf = NUM_OF_FREE_BUFFERS;
 
 
-    return STATUS_SUCCESS;
+	return 0;
 
 
 err_free:
@@ -1089,7 +1091,9 @@ err_free:
 		kfree(pdpram_blk->pbuffer);
 		kfree(pdpram_blk);
 	}
-	return STATUS_FAILURE;
+err_net:
+	free_netdev(netdev);
+	return ret_val;
 }
 
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ