b43: check for allocation failures
authorDan Carpenter <error27@gmail.com>
Thu, 9 Jun 2011 07:09:34 +0000 (10:09 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 10 Jun 2011 18:57:53 +0000 (14:57 -0400)
Add some error handling if the allocation fails.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/bus.c
drivers/net/wireless/b43/main.c

index 6c63aecd6ab47ccff12c7f899219219c55ba1213..8a10b82f8ea7c22a5b486e2b0aac7da30ff944d8 100644 (file)
@@ -83,7 +83,11 @@ void b43_bus_ssb_block_write(struct b43_bus_dev *dev, const void *buffer,
 
 struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev)
 {
-       struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+       struct b43_bus_dev *dev;
+
+       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+       if (!dev)
+               return NULL;
 
        dev->bus_type = B43_BUS_SSB;
        dev->sdev = sdev;
index 1d8d98324d15f3924cca0ccad39e9433ccc6c2fa..7aed9a0eabc4ca40d854e50726962cb0f644512b 100644 (file)
@@ -5025,6 +5025,8 @@ int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
        int first = 0;
 
        dev = b43_bus_dev_ssb_init(sdev);
+       if (!dev)
+               return -ENOMEM;
 
        wl = ssb_get_devtypedata(sdev);
        if (!wl) {