From: Ian Abbott Date: Thu, 4 Apr 2013 13:58:48 +0000 (+0100) Subject: staging: comedi: call comedi_release_hardware_device() on error X-Git-Tag: firefly_0821_release~3680^2~674^2~300 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f5b31e15acd1ab2fd9b9022c29a66f4625fa5658;p=firefly-linux-kernel-4.4.55.git staging: comedi: call comedi_release_hardware_device() on error 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 Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 29c8f5037065..5a506a5bab68 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -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);