aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/css.c
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 /drivers/s390/cio/css.c
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>
Diffstat (limited to 'drivers/s390/cio/css.c')
-rw-r--r--drivers/s390/cio/css.c23
1 files changed, 8 insertions, 15 deletions
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)