提交 f08e0ac5 编写于 作者: I Ian Abbott 提交者: Greg Kroah-Hartman

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: NIan Abbott <abbotti@mev.co.uk>
Reviewed-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 7e1389a9
......@@ -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",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册