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

Commit 98c13c28 authored by Cornelia Huck's avatar Cornelia Huck Committed by Martin Schwidefsky
Browse files

[S390] cio: Reset sch->driver.



sch->driver needs to be reset to NULL on failed probe and after
remove. We also need to check for sch->driver on shutdown.

Signed-off-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 602b20f2
Loading
Loading
Loading
Loading
+13 −9
Original line number Original line Diff line number Diff line
@@ -796,32 +796,36 @@ css_bus_match (struct device *dev, struct device_driver *drv)
	return 0;
	return 0;
}
}


static int
static int css_probe(struct device *dev)
css_probe (struct device *dev)
{
{
	struct subchannel *sch;
	struct subchannel *sch;
	int ret;


	sch = to_subchannel(dev);
	sch = to_subchannel(dev);
	sch->driver = to_cssdriver(dev->driver);
	sch->driver = to_cssdriver(dev->driver);
	return (sch->driver->probe ? sch->driver->probe(sch) : 0);
	ret = sch->driver->probe ? sch->driver->probe(sch) : 0;
	if (ret)
		sch->driver = NULL;
	return ret;
}
}


static int
static int css_remove(struct device *dev)
css_remove (struct device *dev)
{
{
	struct subchannel *sch;
	struct subchannel *sch;
	int ret;


	sch = to_subchannel(dev);
	sch = to_subchannel(dev);
	return (sch->driver->remove ? sch->driver->remove(sch) : 0);
	ret = sch->driver->remove ? sch->driver->remove(sch) : 0;
	sch->driver = NULL;
	return ret;
}
}


static void
static void css_shutdown(struct device *dev)
css_shutdown (struct device *dev)
{
{
	struct subchannel *sch;
	struct subchannel *sch;


	sch = to_subchannel(dev);
	sch = to_subchannel(dev);
	if (sch->driver->shutdown)
	if (sch->driver && sch->driver->shutdown)
		sch->driver->shutdown(sch);
		sch->driver->shutdown(sch);
}
}