[PATCH 5/6] staging: octeon-usb: check return value of platform_device_register_simple

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



the return value is a pointer having an error set. we have to check for
IS_ERR and return PTR_ERR when appropriate

Cc: Aaro Koskinen <aaro.koskinen@xxxxxx>
Cc: David Daney <ddaney.cavm@xxxxxxxxx>
Signed-off-by: Devendra Naga <devendra.aaru@xxxxxxxxx>
---
 drivers/staging/octeon-usb/octeon-hcd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
index 987e6a9..f3a096b 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -23,6 +23,8 @@
 
 #include <linux/usb/hcd.h>
 
+#include <linux/err.h>
+
 //#define DEBUG_CALL(format, ...)         printk(format, ##__VA_ARGS__)
 #define DEBUG_CALL(format, ...)         do {} while (0)
 //#define DEBUG_SUBMIT(format, ...)       printk(format, ##__VA_ARGS__)
@@ -781,9 +783,9 @@ static int __init octeon_usb_module_init(void)
         irq_resource.end = irq_resource.start;
         irq_resource.flags = IORESOURCE_IRQ;
         pdev = platform_device_register_simple((char*)octeon_usb_driver.name, device, &irq_resource, 1);
-        if (!pdev) {
+        if (IS_ERR(pdev)) {
             DEBUG_FATAL("OcteonUSB: Failed to allocate platform device for USB%d\n", device);
-            return -ENOMEM;
+            return PTR_ERR(pdev);
         }
         if (device < MAX_USB_PORTS)
             pdev_glob[device] = pdev;
-- 
1.8.2.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux