aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2009-09-11 04:28:38 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-09-11 04:29:45 -0400
commitc6304933274f8e3cc6983d496456757ac8ab2e0b (patch)
tree7d9135cc2f391141650cc2d1740bd276a25f6141
parentc48ff644f2c86f34f69f382b68b16c6d30854783 (diff)
[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>
-rw-r--r--drivers/char/hvc_iucv.c2
-rw-r--r--drivers/s390/char/monreader.c2
-rw-r--r--drivers/s390/char/vmlogrdr.c4
-rw-r--r--drivers/s390/cio/chp.c3
-rw-r--r--drivers/s390/cio/css.c23
-rw-r--r--drivers/s390/crypto/ap_bus.c2
-rw-r--r--drivers/s390/net/netiucv.c9
-rw-r--r--drivers/s390/net/smsgiucv.c6
8 files changed, 25 insertions, 26 deletions
diff --git a/drivers/char/hvc_iucv.c b/drivers/char/hvc_iucv.c
index 86105efb4eb6..0ecac7e532f6 100644
--- a/drivers/char/hvc_iucv.c
+++ b/drivers/char/hvc_iucv.c
@@ -1006,7 +1006,7 @@ static int __init hvc_iucv_alloc(int id, unsigned int is_console)
1006 priv->dev->release = (void (*)(struct device *)) kfree; 1006 priv->dev->release = (void (*)(struct device *)) kfree;
1007 rc = device_register(priv->dev); 1007 rc = device_register(priv->dev);
1008 if (rc) { 1008 if (rc) {
1009 kfree(priv->dev); 1009 put_device(priv->dev);
1010 goto out_error_dev; 1010 goto out_error_dev;
1011 } 1011 }
1012 1012
diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c
index 3234e90bd7f9..89ece1c235aa 100644
--- a/drivers/s390/char/monreader.c
+++ b/drivers/s390/char/monreader.c
@@ -581,7 +581,7 @@ static int __init mon_init(void)
581 monreader_device->release = (void (*)(struct device *))kfree; 581 monreader_device->release = (void (*)(struct device *))kfree;
582 rc = device_register(monreader_device); 582 rc = device_register(monreader_device);
583 if (rc) { 583 if (rc) {
584 kfree(monreader_device); 584 put_device(monreader_device);
585 goto out_driver; 585 goto out_driver;
586 } 586 }
587 587
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index c20a4fe6da51..d1a142fa3eb4 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -765,8 +765,10 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
765 } else 765 } else
766 return -ENOMEM; 766 return -ENOMEM;
767 ret = device_register(dev); 767 ret = device_register(dev);
768 if (ret) 768 if (ret) {
769 put_device(dev);
769 return ret; 770 return ret;
771 }
770 772
771 ret = sysfs_create_group(&dev->kobj, &vmlogrdr_attr_group); 773 ret = sysfs_create_group(&dev->kobj, &vmlogrdr_attr_group);
772 if (ret) { 774 if (ret) {
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c
index 3e5f304ad88f..40002830d48a 100644
--- a/drivers/s390/cio/chp.c
+++ b/drivers/s390/cio/chp.c
@@ -417,7 +417,8 @@ int chp_new(struct chp_id chpid)
417 if (ret) { 417 if (ret) {
418 CIO_MSG_EVENT(0, "Could not register chp%x.%02x: %d\n", 418 CIO_MSG_EVENT(0, "Could not register chp%x.%02x: %d\n",
419 chpid.cssid, chpid.id, ret); 419 chpid.cssid, chpid.id, ret);
420 goto out_free; 420 put_device(&chp->dev);
421 goto out;
421 } 422 }
422 ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group); 423 ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group);
423 if (ret) { 424 if (ret) {
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 0a3ce6522f0b..45858f3b7318 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -152,18 +152,6 @@ css_alloc_subchannel(struct subchannel_id schid)
152} 152}
153 153
154static void 154static void
155css_free_subchannel(struct subchannel *sch)
156{
157 if (sch) {
158 /* Reset intparm to zeroes. */
159 sch->config.intparm = 0;
160 cio_commit_config(sch);
161 kfree(sch->lock);
162 kfree(sch);
163 }
164}
165
166static void
167css_subchannel_release(struct device *dev) 155css_subchannel_release(struct device *dev)
168{ 156{
169 struct subchannel *sch; 157 struct subchannel *sch;
@@ -332,7 +320,7 @@ int css_probe_device(struct subchannel_id schid)
332 return PTR_ERR(sch); 320 return PTR_ERR(sch);
333 ret = css_register_subchannel(sch); 321 ret = css_register_subchannel(sch);
334 if (ret) 322 if (ret)
335 css_free_subchannel(sch); 323 put_device(&sch->dev);
336 return ret; 324 return ret;
337} 325}
338 326
@@ -649,7 +637,10 @@ __init_channel_subsystem(struct subchannel_id schid, void *data)
649 * not working) so we do it now. This is true e.g. for the 637 * not working) so we do it now. This is true e.g. for the
650 * console subchannel. 638 * console subchannel.
651 */ 639 */
652 css_register_subchannel(sch); 640 if (css_register_subchannel(sch)) {
641 if (!cio_is_console(schid))
642 put_device(&sch->dev);
643 }
653 return 0; 644 return 0;
654} 645}
655 646
@@ -925,8 +916,10 @@ init_channel_subsystem (void)
925 goto out_device; 916 goto out_device;
926 } 917 }
927 ret = device_register(&css->pseudo_subchannel->dev); 918 ret = device_register(&css->pseudo_subchannel->dev);
928 if (ret) 919 if (ret) {
920 put_device(&css->pseudo_subchannel->dev);
929 goto out_file; 921 goto out_file;
922 }
930 } 923 }
931 ret = register_reboot_notifier(&css_reboot_notifier); 924 ret = register_reboot_notifier(&css_reboot_notifier);
932 if (ret) 925 if (ret)
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index ed3dcdea7fe1..ae9ab240c7f1 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -1114,7 +1114,7 @@ static void ap_scan_bus(struct work_struct *unused)
1114 ap_dev->device.release = ap_device_release; 1114 ap_dev->device.release = ap_device_release;
1115 rc = device_register(&ap_dev->device); 1115 rc = device_register(&ap_dev->device);
1116 if (rc) { 1116 if (rc) {
1117 kfree(ap_dev); 1117 put_device(&ap_dev->device);
1118 continue; 1118 continue;
1119 } 1119 }
1120 /* Add device attributes. */ 1120 /* Add device attributes. */
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 8c36eafcfbfe..87dff11061b0 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -1839,9 +1839,10 @@ static int netiucv_register_device(struct net_device *ndev)
1839 return -ENOMEM; 1839 return -ENOMEM;
1840 1840
1841 ret = device_register(dev); 1841 ret = device_register(dev);
1842 1842 if (ret) {
1843 if (ret) 1843 put_device(dev);
1844 return ret; 1844 return ret;
1845 }
1845 ret = netiucv_add_files(dev); 1846 ret = netiucv_add_files(dev);
1846 if (ret) 1847 if (ret)
1847 goto out_unreg; 1848 goto out_unreg;
@@ -2226,8 +2227,10 @@ static int __init netiucv_init(void)
2226 netiucv_dev->release = (void (*)(struct device *))kfree; 2227 netiucv_dev->release = (void (*)(struct device *))kfree;
2227 netiucv_dev->driver = &netiucv_driver; 2228 netiucv_dev->driver = &netiucv_driver;
2228 rc = device_register(netiucv_dev); 2229 rc = device_register(netiucv_dev);
2229 if (rc) 2230 if (rc) {
2231 put_device(netiucv_dev);
2230 goto out_driver; 2232 goto out_driver;
2233 }
2231 netiucv_banner(); 2234 netiucv_banner();
2232 return rc; 2235 return rc;
2233 2236
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c
index e76a320d373b..102000d1af6f 100644
--- a/drivers/s390/net/smsgiucv.c
+++ b/drivers/s390/net/smsgiucv.c
@@ -219,13 +219,13 @@ static int __init smsg_init(void)
219 smsg_dev->driver = &smsg_driver; 219 smsg_dev->driver = &smsg_driver;
220 rc = device_register(smsg_dev); 220 rc = device_register(smsg_dev);
221 if (rc) 221 if (rc)
222 goto out_free_dev; 222 goto out_put;
223 223
224 cpcmd("SET SMSG IUCV", NULL, 0, NULL); 224 cpcmd("SET SMSG IUCV", NULL, 0, NULL);
225 return 0; 225 return 0;
226 226
227out_free_dev: 227out_put:
228 kfree(smsg_dev); 228 put_device(smsg_dev);
229out_free_path: 229out_free_path:
230 iucv_path_free(smsg_path); 230 iucv_path_free(smsg_path);
231 smsg_path = NULL; 231 smsg_path = NULL;