Skip to content

Commit

Permalink
staging: comedi: call comedi_release_hardware_device() on error
Browse files Browse the repository at this point in the history
If `comedi_auto_config()` fails after allocating the minor device, call
`comedi_release_hardware_device()` instead of
`comedi_free_board_minor()` to free the minor device.  That's the same
call that `comedi_auto_unconfig()` uses, and is slightly safer as it
checks the minor device number is still tied to the same hardware
device.

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 3346b79 commit f5b31e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ int comedi_auto_config(struct device *hardware_device,
mutex_unlock(&comedi_dev->mutex);

if (ret < 0)
comedi_free_board_minor(minor);
comedi_release_hardware_device(hardware_device);
return ret;
}
EXPORT_SYMBOL_GPL(comedi_auto_config);
Expand Down

0 comments on commit f5b31e1

Please sign in to comment.