[S390] proper use of device register
Don't use kfree directly after device registration started. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
committed by
Martin Schwidefsky
parent
c48ff644f2
commit
c630493327
@ -1839,9 +1839,10 @@ static int netiucv_register_device(struct net_device *ndev)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = device_register(dev);
|
||||
|
||||
if (ret)
|
||||
if (ret) {
|
||||
put_device(dev);
|
||||
return ret;
|
||||
}
|
||||
ret = netiucv_add_files(dev);
|
||||
if (ret)
|
||||
goto out_unreg;
|
||||
@ -2226,8 +2227,10 @@ static int __init netiucv_init(void)
|
||||
netiucv_dev->release = (void (*)(struct device *))kfree;
|
||||
netiucv_dev->driver = &netiucv_driver;
|
||||
rc = device_register(netiucv_dev);
|
||||
if (rc)
|
||||
if (rc) {
|
||||
put_device(netiucv_dev);
|
||||
goto out_driver;
|
||||
}
|
||||
netiucv_banner();
|
||||
return rc;
|
||||
|
||||
|
@ -219,13 +219,13 @@ static int __init smsg_init(void)
|
||||
smsg_dev->driver = &smsg_driver;
|
||||
rc = device_register(smsg_dev);
|
||||
if (rc)
|
||||
goto out_free_dev;
|
||||
goto out_put;
|
||||
|
||||
cpcmd("SET SMSG IUCV", NULL, 0, NULL);
|
||||
return 0;
|
||||
|
||||
out_free_dev:
|
||||
kfree(smsg_dev);
|
||||
out_put:
|
||||
put_device(smsg_dev);
|
||||
out_free_path:
|
||||
iucv_path_free(smsg_path);
|
||||
smsg_path = NULL;
|
||||
|
Reference in New Issue
Block a user