From patchwork Fri Nov 12 02:51:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: axel lin X-Patchwork-Id: 318622 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAC2lJkq032442 for ; Fri, 12 Nov 2010 02:47:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754449Ab0KLCrS (ORCPT ); Thu, 11 Nov 2010 21:47:18 -0500 Received: from mail-vw0-f46.google.com ([209.85.212.46]:38407 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754216Ab0KLCrS (ORCPT ); Thu, 11 Nov 2010 21:47:18 -0500 Received: by vws13 with SMTP id 13so764405vws.19 for ; Thu, 11 Nov 2010 18:47:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=aSLhnJWSFJh0MHTDbPHcwvKOUJ2JV4QfW6r375bmakk=; b=E9ONVH/5sDvcrTsBJ1gWTjZCd07nSYyTWk9Ba8iq0tQgs+k9jOenI1OD51/j5h7+tD lAZ0rOFqs0pbhJqdyYS+UaMRx2OH0EJIppIaWFkM4ymMA/gJlm/SUnie+EKTMM4DYH4X PVgNKywE9voio0QodS71brFFxw55+vi4aSUKQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=DbA0xMxkg/ut4W+PCdHK2cU66/l19RK0oHGK0tcwX1VFjZx5UnmueLHAXqQO62wZav vCdMcsuwC02joHqbL2fjJOwbUIT+zgk0Emg2Fer03XH9giBlgDqrjR6urnmpRI4wSD7G rXsnH9aGaWXsB3uw9a06P4TDm0kWwdV/mpMVQ= Received: by 10.220.189.11 with SMTP id dc11mr375320vcb.39.1289530037453; Thu, 11 Nov 2010 18:47:17 -0800 (PST) Received: from [192.168.100.50] (60-251-136-127.HINET-IP.hinet.net [60.251.136.127]) by mx.google.com with ESMTPS id o17sm1064718vbi.2.2010.11.11.18.47.14 (version=SSLv3 cipher=RC4-MD5); Thu, 11 Nov 2010 18:47:17 -0800 (PST) Subject: [PATCH 3/3] Input: xpad - fix resource reclaim in xpad_probe error path From: Axel Lin To: linux-kernel Cc: Dmitry Torokhov , Marko Friedemann , Christoph Fritz , linux-input@vger.kernel.org In-Reply-To: <1289530116.20782.2.camel@mola> References: <1289530116.20782.2.camel@mola> Date: Fri, 12 Nov 2010 10:51:21 +0800 Message-Id: <1289530281.20782.6.camel@mola> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 12 Nov 2010 02:47:19 +0000 (UTC) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 26b2f2b..f581301 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -896,15 +896,15 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id error = xpad_init_output(intf, xpad); if (error) - goto fail2; + goto fail3; error = xpad_init_ff(xpad); if (error) - goto fail3; + goto fail4; error = xpad_led_probe(xpad); if (error) - goto fail3; + goto fail5; ep_irq_in = &intf->cur_altsetting->endpoint[0].desc; usb_fill_int_urb(xpad->irq_in, udev, @@ -916,7 +916,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id error = input_register_device(xpad->dev); if (error) - goto fail4; + goto fail6; usb_set_intfdata(intf, xpad); @@ -931,7 +931,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id xpad->irq_in->dev = xpad->udev; error = usb_submit_urb(xpad->irq_in, GFP_KERNEL); if (error) - goto fail4; + goto fail7; /* * Setup the message to set the LEDs on the @@ -940,13 +940,13 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id xpad->bulk_out = usb_alloc_urb(0, GFP_KERNEL); if (!xpad->bulk_out) { error = -ENOMEM; - goto fail5; + goto fail8; } xpad->bdata = kzalloc(XPAD_PKT_LEN, GFP_KERNEL); if (!xpad->bdata) { error = -ENOMEM; - goto fail6; + goto fail9; } xpad->bdata[2] = 0x08; @@ -972,10 +972,15 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id return 0; - fail6: usb_free_urb(xpad->bulk_out); - fail5: usb_kill_urb(xpad->irq_in); - fail4: usb_free_urb(xpad->irq_in); - fail3: xpad_deinit_output(xpad); + fail9: usb_free_urb(xpad->bulk_out); + fail8: usb_kill_urb(xpad->irq_in); + fail7: input_unregister_device(input_dev); + input_dev = NULL; + fail6: xpad_led_disconnect(xpad); + fail5: if (input_dev) + input_ff_destroy(input_dev); + fail4: xpad_deinit_output(xpad); + fail3: usb_free_urb(xpad->irq_in); fail2: usb_free_coherent(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma); fail1: input_free_device(input_dev); kfree(xpad);