Skip to content

Commit

Permalink
staging: comedi: check comedi_auto_config() params
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Apr 5, 2013
1 parent 7e1389a commit f08e0ac
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/staging/comedi/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f08e0ac

Please sign in to comment.