mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
[netdrvr] depca: handle platform_device_add() failure
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>
This commit is contained in:
parent
4bf3631cdb
commit
d91c088b39
@ -1491,8 +1491,9 @@ static void __init depca_platform_probe (void)
|
|||||||
depca_io_ports[i].device = pldev;
|
depca_io_ports[i].device = pldev;
|
||||||
|
|
||||||
if (platform_device_add(pldev)) {
|
if (platform_device_add(pldev)) {
|
||||||
platform_device_put(pldev);
|
|
||||||
depca_io_ports[i].device = NULL;
|
depca_io_ports[i].device = NULL;
|
||||||
|
pldev->dev.platform_data = NULL;
|
||||||
|
platform_device_put(pldev);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user