From patchwork Mon Jul 18 14:29:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger-Novakovic X-Patchwork-Id: 9234689 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B76CA6089D for ; Mon, 18 Jul 2016 14:30:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AACC5228C8 for ; Mon, 18 Jul 2016 14:30:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F32F26B41; Mon, 18 Jul 2016 14:30:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B256269E2 for ; Mon, 18 Jul 2016 14:30:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752021AbcGROaL (ORCPT ); Mon, 18 Jul 2016 10:30:11 -0400 Received: from mout02.posteo.de ([185.67.36.66]:50224 "EHLO mout02.posteo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752027AbcGRO3Y (ORCPT ); Mon, 18 Jul 2016 10:29:24 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 00A3920F82 for ; Mon, 18 Jul 2016 16:29:20 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3rtQXt5Q3sz103w; Mon, 18 Jul 2016 16:29:18 +0200 (CEST) From: Martin Kepplinger To: dmitry.torokhov@gmail.com Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Martin Kepplinger Subject: [PATCH 2/4] input: tablet: pegasus_notetaker: Fix usb_autopm calls to be balanced Date: Mon, 18 Jul 2016 16:29:07 +0200 Message-Id: <1468852149-2614-3-git-send-email-martink@posteo.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1468852149-2614-1-git-send-email-martink@posteo.de> References: <1468852149-2614-1-git-send-email-martink@posteo.de> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Martin Kepplinger --- drivers/input/tablet/pegasus_notetaker.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/input/tablet/pegasus_notetaker.c b/drivers/input/tablet/pegasus_notetaker.c index 27cb352..fdbc5e8 100644 --- a/drivers/input/tablet/pegasus_notetaker.c +++ b/drivers/input/tablet/pegasus_notetaker.c @@ -208,27 +208,30 @@ static int pegasus_open(struct input_dev *dev) return retval; pegasus->irq->dev = pegasus->usbdev; - if (usb_submit_urb(pegasus->irq, GFP_KERNEL)) + if (usb_submit_urb(pegasus->irq, GFP_KERNEL)) { retval = -EIO; + goto out; + } retval = pegasus_set_mode(pegasus, PEN_MODE_XY, NOTETAKER_LED_MOUSE); - usb_autopm_put_interface(pegasus->intf); +out: - return retval; + if (retval < 0) { + usb_autopm_put_interface(pegasus->intf); + return retval; + } else { + return 0; + } } static void pegasus_close(struct input_dev *dev) { struct pegasus *pegasus = input_get_drvdata(dev); - int autopm_error; - autopm_error = usb_autopm_get_interface(pegasus->intf); usb_kill_urb(pegasus->irq); cancel_work_sync(&pegasus->init); - - if (!autopm_error) - usb_autopm_put_interface(pegasus->intf); + usb_autopm_put_interface(pegasus->intf); } static int pegasus_probe(struct usb_interface *intf,