Skip to content

Commit

Permalink
b43: check for allocation failures
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and John W. Linville committed Jun 10, 2011
1 parent 287546d commit 5b49b35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/wireless/b43/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/b43/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5b49b35

Please sign in to comment.