From patchwork Mon Sep 18 11:54:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 141456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2755916vqi; Mon, 18 Sep 2023 08:45:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7YItPyQ0VyXS+Gs9A6stOIBYJ3/exPgXjwXxNdBjCZ9Lac5GE3s5RP3D5kp5tkM50/OJk X-Received: by 2002:a05:6a20:3204:b0:14c:4deb:3dc4 with SMTP id hl4-20020a056a20320400b0014c4deb3dc4mr9670094pzc.31.1695051946594; Mon, 18 Sep 2023 08:45:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695051946; cv=pass; d=google.com; s=arc-20160816; b=FSO8CFxb2KMYHC2LukW2YIiwy+KCIiHXouQt6zz58LPUsCZTCcQr57Hwhw+ZQWgeNa V26nmFErpSCQO/F4Wi0lUdegCTdANvGcbka9NahHrXIHzZnf/a/JTq8bncESIAJIrvSd ik7sKCO1rwNnI+ToUPTMJKuAb/tHAuptsGgkznBB3sUpyKX6OOc3XwZh4T1z0G5JX2GT 9vfzKbx+cdjV5kFIqBArx/elNK5hTcAm0XrcluWvF2YyCKckIc6EGVB9zTGfwJvRLBQB iO7zkn/vVnDl/APcKC4dEKoGsU0tCbQpvoRxYp7oIYLCSCdYJaBPvOi54g+yHjEbAAcZ 0DnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ByEztzR3QuMkR9qnReBnsK1Qq2OKwkHGtxkuklAGczM=; fh=SikQoJLNpGF0HeiQJkcbVWYlrNXIBKXrenHYWqn1frM=; b=uWZFETiGky81dcIeo/YHcrywfHTPDNFGnE+ycsXzueUX9Tb8Vu6ETzdm7TfduZ1yMK xhXfVL2i1zsz6HmqENPB973maZyvzpZHFYJFaqidWyPYlkAYZFJ4QgwmU/29b7kaJWkv YPTJRqdl9Ng1bsjZtTzK6y2n3gvV552Jd/lVsxHilziDxCiJkl+RNuEGSbD2wa6UDyr8 k54rYD/QVJmODaUxfs2UOJaHYfeHnNaiXKkY+e3sEFYObnWKcJ0Sollx6BD03/kQKLop 0RAc1yC29yaj51ZIEHYEmrbWyTly/Xwt/6q+DsQnWDCPe81prd0KiMwvSqOSq088xaQ8 vqaA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=XU1sF9a7; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id g192-20020a636bc9000000b005656a343704si8163700pgc.121.2023.09.18.08.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 08:45:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=XU1sF9a7; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 27AC5819FC6C; Mon, 18 Sep 2023 04:59:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241804AbjIRL7C (ORCPT + 27 others); Mon, 18 Sep 2023 07:59:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241791AbjIRL6c (ORCPT ); Mon, 18 Sep 2023 07:58:32 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2061.outbound.protection.outlook.com [40.107.220.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CFBC10C4; Mon, 18 Sep 2023 04:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k2WoUic1+IJlrnoD7TeH2HTuWdrFYlyJzrbl8ECeAznoYFM0N/TIjPk5Iz2zEkj2gehLXwvP4QKK/vIGn0vvXZfubLI0D/8E50qOPUCafCEUSsfY3tNIB91RXwVFtPaXAw9daf8pJf0mG9b/n2FsyQpKmXR0l79L6pxh71BDpojnqBVC1Phe0I4W/laiBsnZbl6QsPq4Vl6oeFB6aSrUc2yJ0wJ4NXVPvFNna7pQMXFrL5c1MSxYalDQcwANfkcPFYiE7gX8A7TLDzXUNjA5x0W6REIbWPVMVDtw5hMv2azR0IzMAFEPOH0A+/aPGDFOjqGw65Nig5qZ60Ys8cOFgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ByEztzR3QuMkR9qnReBnsK1Qq2OKwkHGtxkuklAGczM=; b=H4plHnD+6iBIrmWLx9MZFX4cF3wIcte1YvmfHS6kbqnpsZidVeng5XTqDbGUsb49X3tLmPEWCX6fA7iyWjO4OlgaqvgZHvchCYFubXUs6hkeaMntNnYi+CKrxHmooRin7mNJdwL1zghiWZXPQPruiQCZ57uAsBkfsi/9KDNjeuJJBDDfN5z+fpM7i3btzDNWUE2jwYV/QhXmxfo20IuaDfdFhnBbUUTVpDLeNJ4tfwtfc5TQ3g/armL1cCV55JwKsAB+5OVdLSbhlfUF1Hzn4n++7xnZgALa03v1J/tnF61K15j3kL5ShCC06J2uBXe7TItzEkF4KAacBFgB9JzP8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ByEztzR3QuMkR9qnReBnsK1Qq2OKwkHGtxkuklAGczM=; b=XU1sF9a7Z7aGpQGhaA7ioFVw1unbIRX96Vk61IuiEjKvnBY73BShHUGQWngtPj539yD4l2azYcf6VZWkYN+4QXLloi2g98oOSvVUwjT6qkRlc92Fvv6o/s96YIaJgKE5WMHRImsRGihx72irehy6Qd/cLIbpdRdiTs/+IXzmwFLMkI73jcK1ZkoEAqFneKsqc9mJTuaGGLqCR0Ow8m/QQHeYkKHvrfc55S92j5HbCZXKfjZOiODg6cF5poghkKvrIZc5tnEH68+9quPlOxpwk3DUSkHhYlU1K3m3T0j0jWADOH4l1Ro1ZbREgX0ZDPg+VBdKcu5eoBlFMVQ48RNxDg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by PH7PR12MB7872.namprd12.prod.outlook.com (2603:10b6:510:27c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Mon, 18 Sep 2023 11:54:47 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::5cc1:1ea3:4ec5:72af]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::5cc1:1ea3:4ec5:72af%5]) with mapi id 15.20.6792.026; Mon, 18 Sep 2023 11:54:47 +0000 From: Rahul Rameshbabu To: Jiri Kosina , Benjamin Tissoires Cc: Christophe JAILLET , kernel-janitors@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Rahul Rameshbabu Subject: [PATCH v3 1/3] HID: nvidia-shield: Fix a missing led_classdev_unregister() in the probe error handling path Date: Mon, 18 Sep 2023 04:54:30 -0700 Message-Id: <20230918115432.30076-2-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918115432.30076-1-rrameshbabu@nvidia.com> References: <20230918115432.30076-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR06CA0032.namprd06.prod.outlook.com (2603:10b6:a03:d4::45) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB2743:EE_|PH7PR12MB7872:EE_ X-MS-Office365-Filtering-Correlation-Id: bd7dc719-d49f-4d76-567e-08dbb83e0e3f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yMFtArjR/U9JD0u15ZE4lH2Dpr70YTfimHZuTd4nKNjkvYEo27A3B0ryNCemH14wjgY6GKdU2PDRn+h5lzplJ9+bVF4JSBroqqsqVKeLdBG2YK1T5KkbsrUvn4UYoF465tpzovLVeRsqvZ8syQPCKcftcyEti4DX/cGXEte7NI3naLKyVdA40LhEr8uTcoZvh3ubnXNQcicOeLzxRpgNNRylDVuzaOFpQ5d3OlxaBFiQJpsIWhJXfVx/c4SrfrKPGbImvIx5C1Y92ShB49JxWQCrHNw3cSehyYPyoldcuyrM6nuBCmCooH6wPtoCCI1fwrwW35mUtfyi0xQ8t8ursd/yqQ2fOSg4q2bOZkVAGhPAKIDnd/bfIduWqf0VRhBe1EJJN9gKPgn+PGS0Y55Fy7tzWYwkTT5M9HBN8MM4rEJXz4FTXiEUF2DlFqgeFC0RY9m/WiZkEXEEKFVBmiIE5u3w32J2m1bunnwjucdsPcCrPq9Fyz6nqnut6AyDhWb0pWADIdDQtIG/igxcR0gCsax7CxaCrNrYnJpyWXtVqGGp/xp1Om077urdzRA350KM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(136003)(376002)(39860400002)(346002)(1800799009)(186009)(451199024)(26005)(2616005)(8936002)(8676002)(1076003)(4326008)(107886003)(83380400001)(2906002)(36756003)(5660300002)(86362001)(6506007)(6486002)(478600001)(6666004)(316002)(54906003)(6512007)(110136005)(66946007)(66476007)(41300700001)(66556008)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I0oWNNpbbfzRFXDC/aavYhtxTq+o6mTcDCYfwl85xirJaMJZ0YgzaNrsNOnwi/NVdAtT4D5Gt5SikJqWCYX3FjJt5eweQk1sQbqFY8JlgR0/ZwEkTsbXFrZJxg8e07nD04PR5hA+ZgRSeS3xXMhZJpo7Bpl5iElTaUHsuFTg5PiQBBnad//kLVEyPSJdDOEeALNJBOEkA6pzP20RbN7jd8c5e7rQS6FnMhVLeOqg/SsHMTM3E9s+yVaMBwST4gYu4OuqBV/jxzeEGYGWT9EonW82ElewOCuhPKE4Wb2VnkfUlDZ+GlQsnecZt5p6LQRposVAD5Wma1ELm43iZ2uaub4Xy+rPtzyEYLFaiTBxM/miCBUiRoup/YYUadTCG8BkhOcJH9KSuZIDgbhXgNPkE8h5zhrzvNr7x5G+wXytW/ugbUqL/DDq5TcriVGGzAT4A50dZbliFtVKPuEXZqGHsxo1rHBNlvVZgDio1DQEePx24/9kc7zjIRqk/XKMCdGU+qAyhamrwuIe6QTIMppVG6u3DVwZkGoYy42XhODr+vhoEqlU/Wo/TltpNddEEwHpdQVTUjBPn270TtBHdkpSW17y3Rs1+VBbW7uOW+nX30aiTVrSnNJ1+ePATRm3eslHDIhpDwUmlY33A7b+n6BjCUjcHW0Az10TzPf1paGMQe3aOM1fNdYEhjpXfuUnTFmHaKrHHgmIUtTenn9Rb+v7+Z++t62RxWaBQj0qd53I53zmYMPgqHl6ET7wAq4/+0mznrwP/d578MUy7Ycm8YGD6V1l0L2mPtr5cnF077tqOpIQ+yKTdFuniBM27d31hW2xTXXVR/125mNmN+HOQAT0MgWnBwSUFqeRis1HfOEcsGbd+AE95WaeNJmlcoCV2sVjJi/tBs8NiLA7fen3fcKuvlaxYk/cHZlzcqf6zDteM/x1/dWXAscpf/ZTvUWn/E4rE2rNkDp72MYTWia65uqMD5Mq4eGj2VO4qhjlc/sI//NZvUsS+1NTn9GzYB/C1QnaP4pQP3+kdAVi5V5Ebh8gcIZH10VrZkf4c3HGtViwpAaKEp2GlYHTtPhtyAjMlOVG4eT9XuxiC6hjA0VDFka2TNneHVEQ7ITgk2pXANHDRC5XwnKKxL8QqXRTPDmD7HJv4mLmAwTbiefGo/9z8tY4EwkJvyeU4mgkeqLTTXXGs4R1CKaVyrsv75jSJZ9WfBXN1IwjIuFyyMFNOPUaVdM+eERRTnnOy+IivUWiM2Vgl17Rqz2iGh3T3qo3oR0pzSAD57m+e/3poKyZV7WdLwg6tbfu07OjnvhqtUUUczA4Rmt3fiv5Q4340CPTOxy6sYd6eDCJzgOSDeEZGBfFgAePOyZ90OVmKs9gDrvqLXSPnr8GZQS09f+/GoDUc8IV6j0uiiGtFE5BJ8tIEY+ovUN0VfKNMAC/txrvwGCvE1Bv4q5dyXV1GW4VW0fW1FLFNYEfjYWYsdQpVUWRwx/JzDSlnm55wtEbdHVP65H24rAJH11SLYC24GP4FMlsvwFMF5Hl8I/JKoG1fL6oltHttG9WgSUPb9U6XOFrztvgu+WmUKTDtYASVBKT5MYPVXpz9yGQLa7vtfoYbILxwlrPQ0HuJA== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd7dc719-d49f-4d76-567e-08dbb83e0e3f X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2023 11:54:47.0740 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CLhhrHljH3Jko+fRaM/tqjaqt6YYY4Li3MGy9bI7fN5yu9d7CPNdSJ2b6ViElaQ8l6Q6Br0mbquWD5mB6Hwd8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7872 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 18 Sep 2023 04:59:33 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777390790193081938 X-GMAIL-MSGID: 1777390790193081938 From: Christophe JAILLET The commit in Fixes updated the error handling path of thunderstrike_create() and the remove function but not the error handling path of shield_probe(), should an error occur after a successful thunderstrike_create() call. Add the missing call. Make sure it is safe to call in the probe error handling path by preventing the led_classdev from attempting to set the LED brightness to the off state on unregister. Fixes: f88af60e74a5 ("HID: nvidia-shield: Support LED functionality for Thunderstrike") Signed-off-by: Christophe JAILLET Reviewed-by: Rahul Rameshbabu --- Notes: Changes: v1->v2: - Add the LED_RETAIN_AT_SHUTDOWN flag to prevent led_classdev_unregister from trying to set the LED to off before a successful call to hid_hw_start. v2->v3: - No changes. drivers/hid/hid-nvidia-shield.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c index 43784bb57d3f..c144641452d3 100644 --- a/drivers/hid/hid-nvidia-shield.c +++ b/drivers/hid/hid-nvidia-shield.c @@ -801,7 +801,7 @@ static inline int thunderstrike_led_create(struct thunderstrike *ts) led->name = devm_kasprintf(&ts->base.hdev->dev, GFP_KERNEL, "thunderstrike%d:blue:led", ts->id); led->max_brightness = 1; - led->flags = LED_CORE_SUSPENDRESUME; + led->flags = LED_CORE_SUSPENDRESUME | LED_RETAIN_AT_SHUTDOWN; led->brightness_get = &thunderstrike_led_get_brightness; led->brightness_set = &thunderstrike_led_set_brightness; @@ -1076,6 +1076,7 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id) err_haptics: if (ts->haptics_dev) input_unregister_device(ts->haptics_dev); + led_classdev_unregister(&ts->led_dev); return ret; } From patchwork Mon Sep 18 11:54:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 141389 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2605022vqi; Mon, 18 Sep 2023 05:08:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+Ay2VK0ozy7+1S+hL3wAc1EPOglX64qSC5LD2wXzExg79wp+0pHMNfCU+29smr+otPHTn X-Received: by 2002:a05:6a20:3d1b:b0:153:8983:d87c with SMTP id y27-20020a056a203d1b00b001538983d87cmr17560851pzi.22.1695038917859; Mon, 18 Sep 2023 05:08:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695038917; cv=pass; d=google.com; s=arc-20160816; b=MBs2GSf8+DzUlwkcs0DzB54Kof9YKb8Y0Lrl4jrCFms9wKI5NtSCT3YFnPS/caTSRi Gp2/sMKJqew+uF0+vQ8iyMHnNVAzNEdoeZCxLQuzE5lwkzaWbiHxVai2czghKZnbpBLZ H4SoTMQYGtD0pREoMLKwjOGuHD6pBP8qVoez3/LY9a5d+HKP9z7bkH+u7N1PDZb4R2ke OuIs4lj545zLBeGEeblcNqDAQfpxRYqnUEG5RKW2sDJPju3/nthpM8EzYza8RwWN0JYd 1NE/XI+HyYxBVdkAMfgpf97zv+Ds6dgeO6nhnVW9kaGqSY1MJtcvShvRtkLtDKi0UJnC ItWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W1FIBDQHRoSpuV6r0BPeSdALbquX/AvwUSU51/p7reo=; fh=SikQoJLNpGF0HeiQJkcbVWYlrNXIBKXrenHYWqn1frM=; b=OO4ZOSJGYigLYCgeeJGpBNCMAd9hbPZnCgZHYFqbfmMzNt5hA6hpfmPNEYLRf7cSY6 OSCOT6UkFQRf9bSUtbYRIhdpLWBxLH1Svy03jLkmDKMeuLiBRlEmRK1lncZxePBrCV18 FQt3MOTOtxpJYZnTjLov/vl5SD+SO8cH7+TLFqkraWna6twKikbOVvn0PssVE8AhvfDi VY+6uJmzYzE8yGA13H8ik1go983TmBqr26T2DkA7YPLfqVZDs7NEOx3Z6EoXbt7eGWVm iT6ompDA4Vs+dUWQh6AyCa9M1HnilQuKOhVKysi6wecrwsJQKX3h5vjEtz8ejtBh0EoC Fr3w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=XfJiihrS; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id m124-20020a632682000000b00565f8b22ca3si7557052pgm.38.2023.09.18.05.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 05:08:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=XfJiihrS; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1CD5B819FC44; Mon, 18 Sep 2023 04:59:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241825AbjIRL7F (ORCPT + 27 others); Mon, 18 Sep 2023 07:59:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241883AbjIRL6q (ORCPT ); Mon, 18 Sep 2023 07:58:46 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2057.outbound.protection.outlook.com [40.107.220.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5F7E172A; Mon, 18 Sep 2023 04:55:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QJmio5g+/675efPyfwqRx7G1Xco5WarcTBrZdrEijqQKPGV6Zq6E52TtT4r/6zaCqShAEFGgTWG0RlOMjFQsMsafrtvcaJP5zVybSTVRf5zAA07ZKJLaUO3KrM/F463qIioFtKU/ALV2OZ8j2sW68MT0XQB/9PL/SCJAonbQjGNnk1v93+Zdlo5ugvEig3OoIAEXvnngUBcIKjxQzmHZUHZf8Fqk4P1gfdoXGXoSvPe2Yz3r6tpmRc5TlEhBdZ3bTsn9NTJKqh2ta9Ov3Bl6qOJb8oX+6FwPToj1QJZozvM2c7pWdva1ZaoRrJmTy+DRUE2mRuwkFJzpPsXEkalMoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W1FIBDQHRoSpuV6r0BPeSdALbquX/AvwUSU51/p7reo=; b=QKgsEEiRJbFq6OXN7/4mh+B9NyvfzuFtYXw5hKGGyQrq/o9pvAzVOA/OeRpA0+nrhYDldA3ZGRaVL+FdP5NUxzl6yPOidKTrgn1o/XEbq7P3iW76mmc3DKT3w0eb+EiMvVpK3Q5i/vffdydGsyy5YpeRxD5EXOI0l+eBKBowq5pkBx33GioGVCd4OjlFRb2n5gpDh3gwRTtfyjoQ1/fU6OF5zUcO4YuaqO7Xq4W7ev+7YGiJPurOQCo2vBZK8eAPbRMxg9lZ4jbRcYLF2zc/tfbemkg7cnHJKXcKMJDWOlWUjihRpHuTc2bojg9jqa2Va6W5IVO2iincjB0psAdgrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W1FIBDQHRoSpuV6r0BPeSdALbquX/AvwUSU51/p7reo=; b=XfJiihrSZ9Q6zqLhp9u+qCLQkX60xvUlA669aw0DF67AL4/MahhiKSdO+elVqBsmTeW/xlnh53jf9ty7eyUs+RLaxlMO3HJVGSRel4qvT31nXDJyc9+y1qY5jxYYeMWgx+IRIfVGV+WA7euS+k09VJWg74Az1keMYrTOZNyThiS0/9xfyJFm+CVRRliW1oEJRsGZPp7RDmWCF60MGm2WEDO1SjqwJ7+G342KqdTthad/R2CjJNeWNUpi9u7umYG3XuKd2FKMcWtpxBVaxZNqoSnhB1sJwONun+Rhz9c8I+tZsSGYZvMSzHIrlQOfE4uMxjwBSm/BH3ybFS1/ecszVA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by PH7PR12MB7872.namprd12.prod.outlook.com (2603:10b6:510:27c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Mon, 18 Sep 2023 11:54:48 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::5cc1:1ea3:4ec5:72af]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::5cc1:1ea3:4ec5:72af%5]) with mapi id 15.20.6792.026; Mon, 18 Sep 2023 11:54:48 +0000 From: Rahul Rameshbabu To: Jiri Kosina , Benjamin Tissoires Cc: Christophe JAILLET , kernel-janitors@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Rahul Rameshbabu Subject: [PATCH v3 2/3] HID: nvidia-shield: Fix some missing function calls() in the probe error handling path Date: Mon, 18 Sep 2023 04:54:31 -0700 Message-Id: <20230918115432.30076-3-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918115432.30076-1-rrameshbabu@nvidia.com> References: <20230918115432.30076-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR06CA0010.namprd06.prod.outlook.com (2603:10b6:a03:d4::23) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB2743:EE_|PH7PR12MB7872:EE_ X-MS-Office365-Filtering-Correlation-Id: b7f7b288-a7fb-4a71-5902-08dbb83e0f4a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OFOp9re/m2sPvJlxuAomrgU/9lIKv2mDwo3exW5MzFXelKtwrRTlKblvVi+EP8mfrQIXuuwSx4wcoE6Rkrx7kux0sR2fnlKuJ4zPqVrceCJbNLXzm+D+PdVEA925Z1A5XqSHjPDo7oezqcGfspy/4tUkTZcScWsnugDRETy66jWkKLn6405XUMpge/7ztkYltrfs4bXcaYDyH5/JR/LcJRCxaacy9+jOZYw59SF7QDFwYnj4XcqZyVew1MYAS7tOEc/kH/YlCe3BSUHQI0mNgXHKKzGiKAJ0dFZho6EX6QAzluxSF5aFEOhv6TScbkca+/PPTJmofuBxl4EOq2ELlvr+WzQGqyu5g4rx6aqWTm927r4SBBm55aiUdFeUzWxa4JcOR5bP0xjynbPeLDAHm8tvRKpiphA+/VuBP5qpnLgRpx+JeJpkCRDaak7w6B0JM6QLaFVdnngTIj7jvWQBwv1T023r0UnsAm6/mjINkweb2JKk+R2pRGa1F9QNJH/ZywK8aoTO7/Q17OwvHiQcLb/b1h5yF5F3vPmGx3TnDx1rw96sPRNnQIMFlF1HOGFi X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(136003)(376002)(39860400002)(346002)(1800799009)(186009)(451199024)(26005)(2616005)(8936002)(8676002)(1076003)(4326008)(107886003)(83380400001)(2906002)(36756003)(5660300002)(86362001)(6506007)(6486002)(478600001)(6666004)(316002)(54906003)(6512007)(110136005)(66946007)(66476007)(41300700001)(66556008)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eDs26dqn7doqk0toQLfXaZ2E9t6weLsN9Ar4CD11PZ4esAt249Uk/8lnm8CJ03JOYAMTAtAXiiGzA4gZfbePWaRuFhx4z7ST+zQqhg9yAagE6D+Tz1/zCtctm/b4/gm4y1vMiACIoKN7Unedcb/2sm+o2MUGRE5/JSNMnqcT50kZPQi4I2c+4jUkoFecl7aali/s1Y4GyCIarChXeZfAKiMFKjsP0gLtaSXxWP4ISoq8ZHGYRIQa9flx09KpAa6wXcdpEazzVsmJDimGOr/8IcTCIPSJWtZ44MIUBeD4u6xozNoKjVGfHV0GuFdG9dDQUzyf0sLng8IRMXmDyEPdbahHDL6cXwRd0djZc8cggZak651G88fBPQ3K1wwMdBibt4R1VZdAI6FDl07Fa5BK4Qij2q3MtyuQMghguwSD/QTucp54wVnqIOQ5Agp4DFP9uG5Sy9+WGm+jmbEop3ZIhUiDkDTd+3tGUnGNR4CNp7HFSqxbiRblJ6TJbCFDZTBuKD9PA1dbLHDZzefqVLIRxyxzXBBYpVNyN1MN3GpvjDhqYjL5EKRYmuNjOTYYkft1lvwiLUuPsvzCuusaa8xjpDGErJGu4iXOvblScKTfrtwaZN3Cbd6l5wdinuyT8RLgGftpWyXCtIa7Of2M8RCKZ1PbPL1JkkaV8aih5oTwIQi6Ws3lT7dr728RrHLOzrGBaLb7spYbMGhuIfq+I83kkqdg8VyitXxd57jdRVbG38LRX+9VqkXrJ9muA6sG0eE8Eu33eY8pZq2vEjGwo+4/bD40sIRYC0fIuks0dp6dWM1yVCtq/VPYxn5suhwaJ5K0MmMBfdBgNl2N17TEIUrnYX/T0XK4X9fyMvcw6wBLyS2DtmKktTm3SJ6CxiS2IC9vRc6uPAoHmGoO7KBuNLB327zjtM5xNh3YOeXp3MQOAYlsMlscQO3gizj1zw73FQssbMXjvlPFCJf346Bj2IpGv8kwyR/GdgkmwJnAnYB3RuJX29gCSHOAVFDteEmIPGE88jNFyE+Cf4GGUSNQvC/22ZFLfsNtcmO4KZ7ZMel4EuhOpse4UzrkYooCZFGNagI1XRFipXuC8QZ4Wb0UqkMsBMAm6OARIFWWgUAvoPaU16MNaerdg4pL+PV7sGh4iA7FQVYZtgvl1g+346D9fn4b6Ff4KJtxV3Ny0s8nlQhTNbtCyuhbIrD07Rlpwoi1xX9OuT4AZKSN2dUK2bcsnRih510/FsKEfU1QVPFTigGMd8wR0QmW+7eZAOvhJuHNFAEaY+fBqbuPbrdjeB6h5KhN+r1mSHsOE4hHYF/Kwmf2Sa99SDIvpaasDZcyyOXdkYj7jrAjL8Ep7AsmmX6p8oE5mozQwIyJcEelQIQx6cjdBGxpdSmsODIU6vtCmAMVCarTgg+oDtaIAZ1oq8BpYpiYTEisAiCeVhYsJvVdFA4DETTQgWXp6T3V5zUxQg6eLAtB9s+574ffrKO1kAWEKBSlkcs8+tlm9loAo8HhYNEHuXSKjk2+2A2Nyd8xF4fCKG4FGNKrBijh/HRsyNG10fi6z5Z4sbf4eFEZijVdicKA7CRaUlwrbobtFQc6q8Cd6FgjgHUpkQ2CoQH6gCXwAsJCRg== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7f7b288-a7fb-4a71-5902-08dbb83e0f4a X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2023 11:54:48.8007 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5Q0xgGsITfuATYXjlSMmJcziB5WFxKCu0y3+isQ8yW9p9fjwo9jZlpHVhr52o2ap8jc6YTAFL0nsx9yQpif6Qg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7872 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 18 Sep 2023 04:59:32 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777377128318275067 X-GMAIL-MSGID: 1777377128318275067 From: Christophe JAILLET The commit in Fixes updated the error handling path of thunderstrike_create() and the remove function but not the error handling path of shield_probe(), should an error occur after a successful thunderstrike_create() call. Add the missing calls. Fixes: 3ab196f88237 ("HID: nvidia-shield: Add battery support for Thunderstrike") Signed-off-by: Christophe JAILLET Reviewed-by: Rahul Rameshbabu --- Notes: Changes: v1->v2: - Rename err_haptics label to err_ts_create to make the label name more accurate. v2->v3: - No changes. drivers/hid/hid-nvidia-shield.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c index c144641452d3..a566f9cdc97d 100644 --- a/drivers/hid/hid-nvidia-shield.c +++ b/drivers/hid/hid-nvidia-shield.c @@ -1058,7 +1058,7 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id) ret = hid_hw_start(hdev, HID_CONNECT_HIDINPUT); if (ret) { hid_err(hdev, "Failed to start HID device\n"); - goto err_haptics; + goto err_ts_create; } ret = hid_hw_open(hdev); @@ -1073,10 +1073,12 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id) err_stop: hid_hw_stop(hdev); -err_haptics: +err_ts_create: + power_supply_unregister(ts->base.battery_dev.psy); if (ts->haptics_dev) input_unregister_device(ts->haptics_dev); led_classdev_unregister(&ts->led_dev); + ida_free(&thunderstrike_ida, ts->id); return ret; } From patchwork Mon Sep 18 11:54:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 141488 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2821767vqi; Mon, 18 Sep 2023 10:19:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4Gny0PrXSvGS81DZZl33zutHEQ1y01YfbtsRdNzQ5BjITc75LYN+n4LgFnnT9l6g3LBR/ X-Received: by 2002:a05:6a20:12ce:b0:153:a897:3be7 with SMTP id v14-20020a056a2012ce00b00153a8973be7mr10968098pzg.15.1695057549530; Mon, 18 Sep 2023 10:19:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695057549; cv=pass; d=google.com; s=arc-20160816; b=twGBe6n/E2PWglB5B6R8Wtas4rqJvoVkv68vf8TnE3o+HbWoEKUP9Mn06NriJMD0Jy N2I/rLUi/HkqhdbeT9aneBrbWhkNel1efRV2PCmGtinAkcdQ7mTm912jeDb/CMl2gKX3 U7lDN+qxXephVIhbRYuKMotj0OMmiF0hFzT7Laqpglj4wpqxg9sEZa6pgBCLIjsjKPWn WNfunMToiZ3OSkkJkgCv2aK/JrR4HpRPiWuz+gG4J1RF7Fn9Lml/MRkeDoRFHlV52f7F IiZ8A7D5WQ1HkyXg+F1dROXQRx8HAkdz1nl6sFZ/0jCRHOvWLRJsA/nV0E7JvBljLZL+ YWJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aeb7NXPu+SVpuJcq0GnojPrdoC4Ed6o8r6TYXWxu18c=; fh=SikQoJLNpGF0HeiQJkcbVWYlrNXIBKXrenHYWqn1frM=; b=QoMuSkWYeBELU5qu1pu6rJMKyaiLzxcb/QQJjmkljNE6L0S/3Na3R7b1A842XQihoi aoSYk2ltx8j641hLVKFN4GD7AJgU3gFEfdqd9hJWJmsokScrJ/+wNHwAbLL8wN/fEbjA cf52yMe14GUOXJxL2a1uEOeSUmKY5DX+aM/zDi3xcNdo5smeIyZanBKqc52GmFh0Oumi a6hMRAPeZ29s5H0oXO4hWJpHZM/am7OibX9bYiYkwGG/j3KDpE+tbvSzKVhLDBKe4nmD cOdxzNzK/CQJaZ8VGczttU+apAg9pty4el6lrgqGK2g0WbZ47ya/+5P0e2tiaQhxuXeH I0Xg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=JH6Ktx8p; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id k14-20020a056a00134e00b0068fa57d2442si8487057pfu.130.2023.09.18.10.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 10:19:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=JH6Ktx8p; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 2C815809C388; Mon, 18 Sep 2023 04:56:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241688AbjIRL4W (ORCPT + 27 others); Mon, 18 Sep 2023 07:56:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241346AbjIRLzv (ORCPT ); Mon, 18 Sep 2023 07:55:51 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2040.outbound.protection.outlook.com [40.107.92.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C64EA10F; Mon, 18 Sep 2023 04:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Exz7EGtXsNfBwM1pdmIOZ3TDbuuwshfb4keJsaTKoNaNrE3PVIJYZq9wbsrLEy84f5rZC3oJugBg2pQ9F4XZKSARoRmm/KPnd6P1FT6ud4MDMFd0YMZmc9TEJTB/GoYZwX3m2C1fvlIa+ouh52hrkY4XSeiXd94azr7bn3KnUncDUt9EgSrbD2ov9bPtjgFjjtHwAY0au81V8hhCXRjPGCFtHLpDvurX02o3Lc6ZbmsPNoJv+VzGFBSKMzbCjOVvZRIVdC+u1FEWTow2VuIU6G3gq2LJiRaF9YVAyGn0LgqnRXF9LjJO2xmWt3CpR+9QULQeWoj2e6BzV3YBpgHI9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aeb7NXPu+SVpuJcq0GnojPrdoC4Ed6o8r6TYXWxu18c=; b=Okli5iyhrTaTKmMd9Ha1D876VKvV8Pqe0uNdv7t7fPBAC191iLWr5G0Luhb+1b24LjLo6a+UcdNg7E2dmLnvnI8g5u4itJa7pcy6Oy29ZRNeWNsKM3ZFxcMtVm7Ohrsp3I+sk0gENe2gYoMlQmRH9wO0EWwUlIWCBgNpSP/3Pot+iE/S63xsUijgY06JdaStZUe31K1c5aOIOpyIMzpL0SF2gnYlANtIv2/SKiCs2NmXF4ejpAqpaPFb8cENfp7zsihqFtm9mKjBq9uI1jxHYrN++Vyb8rpefA40cJuq+LfBnGp4h13GSnIDgaL6oM2yl+kWH1IE+t8jws250qwOfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aeb7NXPu+SVpuJcq0GnojPrdoC4Ed6o8r6TYXWxu18c=; b=JH6Ktx8pJmekqwJwZBDzSxZAhlIgMz1W3ZkJnLSDu4TWnCDFQChDEmHGdLqIRHwxos5qvDYIvrzIXgqV10EXZa/LnOyIiybsG5bs43FrwDHF11+LNz0oA97OZJTrU6AOOxgQ8QBs0huWxRNgGwp5lkwW0U2RssYBWYJp51p//veNqLwQ54u7NT9s8ql3hNxydxtZ1JJ8RP+edcWgyVPhKtpSYfGdx1qUG4OLc48ZUapgAB09qSmc6kU3Iw6nnlIQM8vhz19BeIxRS222N5jCLYz7+dreKqXngYbek0uljFy9iTNOCd+KHRQmCoelBTJrpv5JLzqRD7+MI7TB5p5FPw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by DS0PR12MB9346.namprd12.prod.outlook.com (2603:10b6:8:1be::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27; Mon, 18 Sep 2023 11:54:50 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::5cc1:1ea3:4ec5:72af]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::5cc1:1ea3:4ec5:72af%5]) with mapi id 15.20.6792.026; Mon, 18 Sep 2023 11:54:50 +0000 From: Rahul Rameshbabu To: Jiri Kosina , Benjamin Tissoires Cc: Christophe JAILLET , kernel-janitors@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Rahul Rameshbabu Subject: [PATCH v3 3/3] HID: nvidia-shield: Introduce thunderstrike_destroy() Date: Mon, 18 Sep 2023 04:54:32 -0700 Message-Id: <20230918115432.30076-4-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918115432.30076-1-rrameshbabu@nvidia.com> References: <20230918115432.30076-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BY3PR05CA0002.namprd05.prod.outlook.com (2603:10b6:a03:254::7) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB2743:EE_|DS0PR12MB9346:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c6d9c14-6bba-4e28-5d86-08dbb83e1036 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CREfAjYvumeXMZoZQ1mp5W21Cif+fDm3hvDmcyoHxjUSWeB+pBzM6GR5EuA5IZEAvG3xlXcyZJnBLG2S/5RtjBBE7nHsToZMAUJAsoDFMTprYkv5ED0fuTbRMrLME8X604vUkp788lTL7fVJ80oBTE3kfSpuTqOiYwNPyZRrVLsvi0sMVI68vTWvSF8FzxfKWnBLRPHL6kWQYLD0WEZAqn67wCu4/PtB/1lEcBkBYPjL9PuYBqFc580H3Xl1Kz0LdalIFtmc8rZUnuYOCAVMdE01kAqNZXTJiIje6EwLwuWQpcPPiKXtLf0M4QCDURDlhPWzihnjMi1Dqd3RWnpZNL40XHtB4P1xES5p1jsZ5SVeuSSILpMW35aRNvAAvW5exEwEVG7revOsNImYVh4BBx+RuSN+R12odMcwHo1hL9jNzJSyh+S7NT0TOIIoPddvyIRXkiF6yGidmFjsM9bvWKzNRejRsynv9vZqZssrgiKKUaYKYNQOygJ3+PMGMnJdKz2WGXPwVQrDEP2Rymvn8OjVH+hP2oSiKm32ToJHG8bH2XkDqPWe5l4dZuiriw6v X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(366004)(136003)(376002)(346002)(186009)(1800799009)(451199024)(6486002)(6506007)(6512007)(6666004)(83380400001)(86362001)(38100700002)(36756003)(107886003)(2616005)(1076003)(26005)(316002)(41300700001)(8936002)(8676002)(4326008)(2906002)(66946007)(54906003)(66476007)(66556008)(110136005)(478600001)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1Y6Aa8yCZiwDRtjc3+iOaMyrJPO6Enssffq9KPmpjlskIpiD4zAYPl9Q0PrKGkii5eNrp4/4s7XTOBprjmhPxB9RmMWiwa0+llmVXW7jqm/y0bPPs+ijRzyWPA+nulU4PQlpo5D/sbz9iAOfhHliZ6idfCQQPCKcmiMmCIEBWkiOJAQ5bl4nOkwoxowKgJRkgGFenCuUvY+xRU5eQy6WufPxx7LhSK5zo1VANEpDBoHhfM1l6mme5jOQrR/iPijLKGQNAKqIcaY0No+Hpeae8t9uHfeyiuuOrFHKHD4U/mFyPsVWMpcLeybTTP1R50comyNmYeyCBtiKzld1p3MFc7SlIoPaXKEeEkLnwptZymAJeys/57eXT+9hEdYWb/qFCHjP3vy1LkNPe9BC2tVhtRBtcEz0EQ0TufwrU0AeTDZvUt+pgorBxVVcyyWk9vGuv868RxIdHZ51lvjNtLK00uYz8psqkloirFQgQKlHR611XCzGMe4R2A+aSb4hwgGt0b7pS0mzkFMnx4XYvvpV8Zux4x/C0rJdoVnl7yii1uD6IAhfZGIbwD0YHD8wBM9z1IQB8kJNKsPhcT5oMQ8MsNjwzP6FjElKx+FMK0Gspkhve1gwYWTbhkklr6xyKRs8J7mCQBl/9MtxKe7ogedHJdk7c6XlMxZ1WBiXSbK84wH8zHsVrnecLMY0VnCqNwVUGN5A04CG7PzziLVgGKVUh6/vJBsuSrcjnATLJz/Zii5RpTSYWlAug4PpaBCdVdMkQ930+maHO3ZGIpc+OJRPg7GXE0NTubZGKKnJpgLZidBlDyYAWnaqv7vXXolnDXI4GqyHNUqLxWvprJFOavRUqvb9Nbbog6cwhyqNLLUwVGFAH6cw+bGXTl/o/nwkrEvLsITFRzTnkb8q7wyCgF5ohat1eIcqqUYejWauqZiYwz8PAL4x50SSzYzWappORE45bRS35gqkSm34UVFnh1Q3MkzzOILA2VodxwPBRbaOuyBxjbBLI3xeZ3E2h6RCBJRb6Jgmbvo4jvEhLxblPwXE5DbDSbE7ovFJiOmlFynY6tYKPEBKIZLS+8sLGWg5KZq5FY0k5qgtMeoT26UT6Yn3Y3GzmrD4LpdEXolSvT+PNmF5u9fNDBzLKdLH5+tr+NxUwAw+VtSfc50QRlCsZ5uDiQN8HnmTx4hf/Jgcxjkx9JztIWtfkMHJVW7vm5CSAsNNDprICCMgI612DBWWNj5Lj0gGrc0Vm3iwl9mFwit4tJQXowV/wVV4zF5Eh7/NjpvSeLAXT5wAQyupWvlxsdYjsXk7FdUayC+6PWhncWKSD8Q6TkkxncN7a/cHDmOtMI2ElkEnHjCnf7+ng0xE7dy4Su0ChkAqqJXJTsAErt5uTyu9+Wh7VtG6eDsOvT5PwfyrDdrfj2/GCEs8JVzpGKZs8J4XJcIQeWqE6Jf8g/IguvyQODBCUgA7088+yex9RosuMZ4I+X6HpnkbP6sqLCBS0vmZNFj0GKthtWAc7ILQApq5bpo9wbousykonSjmx6CCKa2W17qwCQKBL2OuCxhq5tlh+EiQPbpAe6X5O2Gz8bUZl9m85hs52Maq4gqepVle X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c6d9c14-6bba-4e28-5d86-08dbb83e1036 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2023 11:54:50.3746 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Xyr4U2Otah3fjMO0zXnA/pnjdqjuA4zOO/Sshj85hAwDcUYCcgSFPgv+HtOXdvPisOwsz7tzoyCeOnh0bfFHXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9346 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 18 Sep 2023 04:56:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777396665231675379 X-GMAIL-MSGID: 1777396665231675379 From: Christophe JAILLET In order to simplify some error handling paths and avoid code duplication, introduce thunderstrike_destroy() which undoes thunderstrike_create(). Signed-off-by: Christophe JAILLET Reviewed-by: Rahul Rameshbabu --- Notes: Changes: v1->v2: - Re-order operations in thunderstrike_destroy to be in LIFO order with regards to the operations in thunderstrike_create. v2->v3: - Refactor thunderstrike_destroy to take a thunderstrike instance pointer as a parameter and prevent a variable from being unused in shield_probe. drivers/hid/hid-nvidia-shield.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c index a566f9cdc97d..bc47e19ef117 100644 --- a/drivers/hid/hid-nvidia-shield.c +++ b/drivers/hid/hid-nvidia-shield.c @@ -915,6 +915,15 @@ static struct shield_device *thunderstrike_create(struct hid_device *hdev) return ERR_PTR(ret); } +static void thunderstrike_destroy(struct thunderstrike *ts) +{ + led_classdev_unregister(&ts->led_dev); + power_supply_unregister(ts->base.battery_dev.psy); + if (ts->haptics_dev) + input_unregister_device(ts->haptics_dev); + ida_free(&thunderstrike_ida, ts->id); +} + static int android_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, @@ -1074,11 +1083,7 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id) err_stop: hid_hw_stop(hdev); err_ts_create: - power_supply_unregister(ts->base.battery_dev.psy); - if (ts->haptics_dev) - input_unregister_device(ts->haptics_dev); - led_classdev_unregister(&ts->led_dev); - ida_free(&thunderstrike_ida, ts->id); + thunderstrike_destroy(ts); return ret; } @@ -1090,11 +1095,7 @@ static void shield_remove(struct hid_device *hdev) ts = container_of(dev, struct thunderstrike, base); hid_hw_close(hdev); - power_supply_unregister(dev->battery_dev.psy); - if (ts->haptics_dev) - input_unregister_device(ts->haptics_dev); - led_classdev_unregister(&ts->led_dev); - ida_free(&thunderstrike_ida, ts->id); + thunderstrike_destroy(ts); del_timer_sync(&ts->psy_stats_timer); cancel_work_sync(&ts->hostcmd_req_work); hid_hw_stop(hdev);