mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
Input: pegasus_notetaker - fix usb_autopm calls to be balanced
We should only "put" the interface if submitting URB or setting tablet mode in pegasus_open() fails, otherwise leave it to pegasus_close(). Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
168c1398e0
commit
9d3bef0be5
1 changed files with 19 additions and 14 deletions
|
@ -209,33 +209,38 @@ static void pegasus_init(struct work_struct *work)
|
||||||
static int pegasus_open(struct input_dev *dev)
|
static int pegasus_open(struct input_dev *dev)
|
||||||
{
|
{
|
||||||
struct pegasus *pegasus = input_get_drvdata(dev);
|
struct pegasus *pegasus = input_get_drvdata(dev);
|
||||||
int retval;
|
int error;
|
||||||
|
|
||||||
retval = usb_autopm_get_interface(pegasus->intf);
|
error = usb_autopm_get_interface(pegasus->intf);
|
||||||
if (retval)
|
if (error)
|
||||||
return retval;
|
return error;
|
||||||
|
|
||||||
pegasus->irq->dev = pegasus->usbdev;
|
pegasus->irq->dev = pegasus->usbdev;
|
||||||
if (usb_submit_urb(pegasus->irq, GFP_KERNEL))
|
if (usb_submit_urb(pegasus->irq, GFP_KERNEL)) {
|
||||||
retval = -EIO;
|
error = -EIO;
|
||||||
|
goto err_autopm_put;
|
||||||
|
}
|
||||||
|
|
||||||
retval = pegasus_set_mode(pegasus, PEN_MODE_XY, NOTETAKER_LED_MOUSE);
|
error = pegasus_set_mode(pegasus, PEN_MODE_XY, NOTETAKER_LED_MOUSE);
|
||||||
|
if (error)
|
||||||
|
goto err_kill_urb;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_kill_urb:
|
||||||
|
usb_kill_urb(pegasus->irq);
|
||||||
|
cancel_work_sync(&pegasus->init);
|
||||||
|
err_autopm_put:
|
||||||
usb_autopm_put_interface(pegasus->intf);
|
usb_autopm_put_interface(pegasus->intf);
|
||||||
|
return error;
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pegasus_close(struct input_dev *dev)
|
static void pegasus_close(struct input_dev *dev)
|
||||||
{
|
{
|
||||||
struct pegasus *pegasus = input_get_drvdata(dev);
|
struct pegasus *pegasus = input_get_drvdata(dev);
|
||||||
int autopm_error;
|
|
||||||
|
|
||||||
autopm_error = usb_autopm_get_interface(pegasus->intf);
|
|
||||||
usb_kill_urb(pegasus->irq);
|
usb_kill_urb(pegasus->irq);
|
||||||
cancel_work_sync(&pegasus->init);
|
cancel_work_sync(&pegasus->init);
|
||||||
|
|
||||||
if (!autopm_error)
|
|
||||||
usb_autopm_put_interface(pegasus->intf);
|
usb_autopm_put_interface(pegasus->intf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue