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

Commit f08e0ac5 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman
Browse files

staging: comedi: check comedi_auto_config() params



Do some minimal error checking of the parameters of
`comedi_auto_config()`.  Just make sure the `hardware_device` and
`driver` parameters are non-NULL.

Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7e1389a9
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -410,6 +410,16 @@ int comedi_auto_config(struct device *hardware_device,
	struct comedi_device *comedi_dev;
	int ret;

	if (!hardware_device) {
		pr_warn("BUG! comedi_auto_config called with NULL hardware_device\n");
		return -EINVAL;
	}
	if (!driver) {
		dev_warn(hardware_device,
			 "BUG! comedi_auto_config called with NULL comedi driver\n");
		return -EINVAL;
	}

	if (!driver->auto_attach) {
		dev_warn(hardware_device,
			 "BUG! comedi driver '%s' has no auto_attach handler\n",