From patchwork Mon Sep 17 20:17:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cheng, Ping" X-Patchwork-Id: 1469581 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 72D41DF2D8 for ; Mon, 17 Sep 2012 20:31:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753423Ab2IQUbX (ORCPT ); Mon, 17 Sep 2012 16:31:23 -0400 Received: from exprod5og114.obsmtp.com ([64.18.0.28]:56174 "HELO exprod5og114.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753238Ab2IQUbX (ORCPT ); Mon, 17 Sep 2012 16:31:23 -0400 X-Greylist: delayed 675 seconds by postgrey-1.27 at vger.kernel.org; Mon, 17 Sep 2012 16:31:22 EDT Received: from Exchange1.wacom.com ([67.51.163.2]) by exprod5ob114.postini.com ([64.18.4.12]) with SMTP ID DSNKUFeImnGiKPjJjw3VWyGqZCjfEUwkIdZ4@postini.com; Mon, 17 Sep 2012 13:31:23 PDT From: Ping Cheng To: Axel Lin , Jiri Kosina , "eduard@hasenleithner.at" CC: Przemo Firszt , "linux-input@vger.kernel.org" Subject: RE: [PATCH v2] HID: wacom: Fix wacom_probe error handling Date: Mon, 17 Sep 2012 20:17:26 +0000 Message-ID: References: <1347872034.7737.4.camel@phoenix> In-Reply-To: <1347872034.7737.4.camel@phoenix> Content-Language: en-US MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org If device_remove_file is needed for hid-wacom.c, it should be considered for wacm_sys.c as well. Eduard, what do you think? Ping -----Original Message----- From: Axel Lin [mailto:axel.lin@gmail.com] Sent: Monday, September 17, 2012 1:54 AM To: Jiri Kosina Cc: Przemo Firszt; Ping Cheng; linux-input@vger.kernel.org Subject: [PATCH v2] HID: wacom: Fix wacom_probe error handling OLEDs/LED are not critical for tablet functioning thus ignore OLED/LED initialisation failures. This patch does clean up all the sysfs attribute files in error paths. Signed-off-by: Axel Lin --- drivers/hid/hid-wacom.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) ret = power_supply_register(&hdev->dev, &wdata->battery); if (ret) { - hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n", - ret); + hid_err(hdev, "can't create sysfs battery attribute, err: %d\n", + ret); goto err_battery; } @@ -891,8 +889,8 @@ OLED_INIT(7); ret = power_supply_register(&hdev->dev, &wdata->ac); if (ret) { - hid_warn(hdev, - "can't create ac battery attribute, err: %d\n", ret); + hid_err(hdev, + "can't create ac battery attribute, err: %d\n", ret); goto err_ac; } @@ -902,10 +900,17 @@ OLED_INIT(7); err_ac: power_supply_unregister(&wdata->battery); err_battery: + wacom_destroy_leds(hdev); + device_remove_file(&hdev->dev, &dev_attr_oled0_img); + device_remove_file(&hdev->dev, &dev_attr_oled1_img); + device_remove_file(&hdev->dev, &dev_attr_oled2_img); + device_remove_file(&hdev->dev, &dev_attr_oled3_img); + device_remove_file(&hdev->dev, &dev_attr_oled4_img); + device_remove_file(&hdev->dev, &dev_attr_oled5_img); + device_remove_file(&hdev->dev, &dev_attr_oled6_img); + device_remove_file(&hdev->dev, &dev_attr_oled7_img); device_remove_file(&hdev->dev, &dev_attr_speed); hid_hw_stop(hdev); -destroy_leds: - wacom_destroy_leds(hdev); err_free: kfree(wdata); return ret; -- 1.7.9.5 diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index a0fafac..2f60da9 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -858,11 +858,9 @@ OLED_INIT(7); if (hdev->product == USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) { sprintf(hdev->name, "%s", "Wacom Intuos4 WL"); ret = wacom_initialize_leds(hdev); - if (ret) { + if (ret) hid_warn(hdev, "can't create led attribute, err: %d\n", ret); - goto destroy_leds; - } } wdata->battery.properties = wacom_battery_props; @@ -875,8 +873,8 @@ OLED_INIT(7);