Skip to content

Commit

Permalink
[netdrvr] depca: handle platform_device_add() failure
Browse files Browse the repository at this point in the history
The following patch fixes a kernel bug in depca_platform_probe().

We don't use a dynamic pointer for pldev->dev.platform_data, so it seems
that the correct way to proceed if platform_device_add(pldev) fails is
to explicitly set the pldev->dev.platform_data pointer to NULL, before
calling the platform_device_put(pldev), or it will be kfree'ed by
platform_device_release().

Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Andrea Righi authored and Jeff Garzik committed Apr 24, 2007
1 parent 4bf3631 commit d91c088
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/depca.c
Original file line number Diff line number Diff line change
Expand Up @@ -1491,8 +1491,9 @@ static void __init depca_platform_probe (void)
depca_io_ports[i].device = pldev;

if (platform_device_add(pldev)) {
platform_device_put(pldev);
depca_io_ports[i].device = NULL;
pldev->dev.platform_data = NULL;
platform_device_put(pldev);
continue;
}

Expand Down

0 comments on commit d91c088

Please sign in to comment.