Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6304933 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky
Browse files

[S390] proper use of device register



Don't use kfree directly after device registration started.

Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent c48ff644
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1006,7 +1006,7 @@ static int __init hvc_iucv_alloc(int id, unsigned int is_console)
	priv->dev->release = (void (*)(struct device *)) kfree;
	rc = device_register(priv->dev);
	if (rc) {
		kfree(priv->dev);
		put_device(priv->dev);
		goto out_error_dev;
	}

+1 −1
Original line number Diff line number Diff line
@@ -581,7 +581,7 @@ static int __init mon_init(void)
	monreader_device->release = (void (*)(struct device *))kfree;
	rc = device_register(monreader_device);
	if (rc) {
		kfree(monreader_device);
		put_device(monreader_device);
		goto out_driver;
	}

+3 −1
Original line number Diff line number Diff line
@@ -765,8 +765,10 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
	} else
		return -ENOMEM;
	ret = device_register(dev);
	if (ret)
	if (ret) {
		put_device(dev);
		return ret;
	}

	ret = sysfs_create_group(&dev->kobj, &vmlogrdr_attr_group);
	if (ret) {
+2 −1
Original line number Diff line number Diff line
@@ -417,7 +417,8 @@ int chp_new(struct chp_id chpid)
	if (ret) {
		CIO_MSG_EVENT(0, "Could not register chp%x.%02x: %d\n",
			      chpid.cssid, chpid.id, ret);
		goto out_free;
		put_device(&chp->dev);
		goto out;
	}
	ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group);
	if (ret) {
+8 −15
Original line number Diff line number Diff line
@@ -151,18 +151,6 @@ css_alloc_subchannel(struct subchannel_id schid)
	return sch;
}

static void
css_free_subchannel(struct subchannel *sch)
{
	if (sch) {
		/* Reset intparm to zeroes. */
		sch->config.intparm = 0;
		cio_commit_config(sch);
		kfree(sch->lock);
		kfree(sch);
	}
}

static void
css_subchannel_release(struct device *dev)
{
@@ -332,7 +320,7 @@ int css_probe_device(struct subchannel_id schid)
		return PTR_ERR(sch);
	ret = css_register_subchannel(sch);
	if (ret)
		css_free_subchannel(sch);
		put_device(&sch->dev);
	return ret;
}

@@ -649,7 +637,10 @@ __init_channel_subsystem(struct subchannel_id schid, void *data)
	 * not working) so we do it now. This is true e.g. for the
	 * console subchannel.
	 */
	css_register_subchannel(sch);
	if (css_register_subchannel(sch)) {
		if (!cio_is_console(schid))
			put_device(&sch->dev);
	}
	return 0;
}

@@ -925,9 +916,11 @@ init_channel_subsystem (void)
				goto out_device;
		}
		ret = device_register(&css->pseudo_subchannel->dev);
		if (ret)
		if (ret) {
			put_device(&css->pseudo_subchannel->dev);
			goto out_file;
		}
	}
	ret = register_reboot_notifier(&css_reboot_notifier);
	if (ret)
		goto out_unregister;
Loading