mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-26 04:25:27 +08:00
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: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7e1389a9e6
commit
f08e0ac59a
@ -410,6 +410,16 @@ int comedi_auto_config(struct device *hardware_device,
|
|||||||
struct comedi_device *comedi_dev;
|
struct comedi_device *comedi_dev;
|
||||||
int ret;
|
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) {
|
if (!driver->auto_attach) {
|
||||||
dev_warn(hardware_device,
|
dev_warn(hardware_device,
|
||||||
"BUG! comedi driver '%s' has no auto_attach handler\n",
|
"BUG! comedi driver '%s' has no auto_attach handler\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user