Check the return value of kzalloc & return error if it fails.

Signed-off-by: Gujulan Elango Hari Prasath <hguju...@visteon.com>
---
 drivers/staging/dgnc/dgnc_driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 935e297..2c729be 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -589,6 +589,8 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
         * context, and there are no locks held.
         */
        brd->flipbuf = kzalloc(MYFLIPLEN, GFP_KERNEL);
+       if (!brd->flipbuf)
+               return -ENOMEM;
 
        wake_up_interruptible(&brd->state_wait);
 
-- 
1.9.1
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to