From patchwork Mon Sep 18 11:54:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 14158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2813897vqi; Mon, 18 Sep 2023 10:08:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHadFMPYobCC1ud0PjqSOYXtrZxwG972QOs36LgHaS/tWYF6kRu6Bx5eR/X3uyQA3wY/yB X-Received: by 2002:a05:6a00:983:b0:68f:d6db:5d4b with SMTP id u3-20020a056a00098300b0068fd6db5d4bmr265919pfg.12.1695056889292; Mon, 18 Sep 2023 10:08:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695056889; cv=pass; d=google.com; s=arc-20160816; b=IjI3tWY/h5AkaDva0C3zsEnx9C1jkkTB+F0VCzldPU8LGfzKebqP59rlaapvetUy8B Wm31l9sRRJctshvNRhIVa9FZDi5snw5FiT80BZE9ncZktbmtgfDI3YDNOdqraQvBuqoL JBYciG1XxuX8CYuN5xRmhxl0z5+0sUgXW3p7yDkTmD2TaXfhYFJgswdO9p54U5Fkp55z xr0AG5vPhOzX1UBga/hzrCPl4g2ZS05jwidiLyWVn3NQbjI0IP9FvNkzKsEaG5A1ZsMZ Bv0D0q7Vw1k5XMBQElh1m4Y2rFunJUwNLAnjPTp+z4gNitCiqMw2Y72d9TDSJ3eDsNzo urCg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=VeRzHHEC9N8TLcL30izVuKIHODCdH6kdTThQsE5G9N4=; fh=SikQoJLNpGF0HeiQJkcbVWYlrNXIBKXrenHYWqn1frM=; b=QUbFOxObmjWLXz00RYQ5SBpBEqQKpn+V3WXMEz0RUvoVCuOcui/fE24kXnbPdyWyc/ OfhHBbb5L2wAeplMryBQ+G4ZRcBdB/YrShGu5CjS93CqVvngtK4dP2qwBgKPZj6UiJf1 8fRG2/c4g5DP3F6se1xrIz2jgD4nOz+NWi6HWCji4wXk93Phci3qEZ/zURnhER/tcQAY 9C8/i6ihqYt4b8lMbEhNWfbDITtEEY4gea03XR/N6YH2D/ab925Y8BNJr2gv7rD7sa1R RkyXfUkf92Bu99wgY3oSsHI+IOVhmNIxn7RCT9mvmBd0xY0CVQ/tMWhWew4jcH3D0OZS n35w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=SryFs1gY; 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:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ch11-20020a056a00288b00b0069022a03d42si8406917pfb.283.2023.09.18.10.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 10:08:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=SryFs1gY; 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:7 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 03D30819DFC6; Mon, 18 Sep 2023 04:59:07 -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 S241790AbjIRL6c (ORCPT + 27 others); Mon, 18 Sep 2023 07:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241809AbjIRL6J (ORCPT ); Mon, 18 Sep 2023 07:58:09 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2085.outbound.protection.outlook.com [40.107.220.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FAA519A9; Mon, 18 Sep 2023 04:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dvpi7oG++m27m3gnRVYpLhSQQhAu9JoI/YzJzm82kt5Rrr/S+1WLWJdXCcwFtmXXldhDcA8mc0n6NjokFNftskRidRAvfJjCjDmVVKLnEuIAnbIVkFuKzTDuPOr2iTGXdcadfVEpR8AW+TVlNAnuiPgnoG0X5tg7RKD0Epg/73w0DPq3eV0shXGNrs0yV69rDw2D2zXxLYokENmQWZgTAz1wuCa/gnslzhuG8fNscys1D//MUic4JdinUvY1RBErCEnxx2R2xjqNg5CZHOgdULGv3lbGZY4CgoWnD9SMd2AXpUlriO3Gauw0YcvrqIJCKtriJxTEcQvk8dyZ3eQ+AA== 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=VeRzHHEC9N8TLcL30izVuKIHODCdH6kdTThQsE5G9N4=; b=CmnSQHxf4Ngf/8Ben30a00JlJkMhneIoUmjJGnQtJo8AQS30cPYlj/UcMv1MnDGgNqVdgYLVqt+fwemK1/dbduB7FAdd82wNQDhv8xwHMob7stM3flp4mwPCpltqxeD32HcFfnoJD683g6fhHCpiggGyNo4fOApk9BkezRLLDl4GGTpuV7auhlxH7uaCW3xHnPBjoG/EUH7SiDCFI4DiZE5p51HiSmB5axgxgyq/KqXIeXQCr3/ixM8cu0OLbtpiIyo+q6txqNqqfYITcVm6I5Uw1nL8HeL1VwwMX4+OZmWNB0rlVJx2Ny6lDV+fEPOuo2T64/HcWAe7T1GtDGQMDA== 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=VeRzHHEC9N8TLcL30izVuKIHODCdH6kdTThQsE5G9N4=; b=SryFs1gYVJsiCRWkG55MTyMijU/2yHFMCM8qADqgouMRzlZfAF1Pts/CPsIwLbJ7KMFD0nafXrwT2EmOfSmKX1bzCxDQjlcrAnlVm8/1NVVlHbPuQbODyXktyRGZJCDRQzXaetG7QX8I1iNF8PlO3c9AcLtEnoGdLMnJdwwHOr8H/hhS5kAZvdfZE12QakdzUGPX3RoaSn3bamCVtU5Gsg4WHA7PZ8FeRp9Jq6Jhl6wTT8Phy8UzrCZkgNfRRM2Vvfge5ICjlZMj4wegur4K/4dwIxl1SpR7jPhH8G0ALlxLnK83iS4QZiui4hKQfsQHpkvT2NsMyywPqc8JbMu/hA== 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:45 +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:45 +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 0/3] HID: nvidia-shield: Fix the error handling path of shield_probe() Date: Mon, 18 Sep 2023 04:54:29 -0700 Message-Id: <20230918115432.30076-1-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: BY3PR05CA0010.namprd05.prod.outlook.com (2603:10b6:a03:254::15) 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: 10e85b63-5415-4fbc-6677-08dbb83e0d47 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rXEMsmnY6Ynh2kz1fwT2Ty3+WpJKR+EO26vSbyz+TuSJ5/Z3ORP+12Fm81Qp9w0rb7ZVaTtyENbQJ7dpExQ0wrJRq2+JKf9klQMCSEyh02i9NWwl109q9bSaDnpKayhAozA5eyKytq9VgS1TwkVkrTJwS9V/pm8sB18Wj7Lf0QuPyjCg0i2jOUC7Jva5SqIw1gEIgqv7ebmu2lL9wCcgZIyVku8SnYaW+QnI21yrS8YgCBEPOW5m4HEkOPS1eOpscqkduPnUMCZDtloZIkoqW/fNaO1CsvvTyT4FuCT3Fh4b4S0usU0wmYUSi5gix2nbZiidj6jO/ksIFDC7xYKIPEvB5RIGCY43PFtJyDgx8V5FA4XZLiNzHVzj4abcF1TGuFiF/wr9MiZ3KWzTGqA5e/FoWDrdDehNOf9h13Zvjdhvo/kvyePMTEwpV62Sads02LPKZddQURRmhV5wZzyj8QfL90JJNeNhhpTph2zg+HY49QalDMBpodMQAH3JKGPfJpzg3P904d83483bZkmSNKB3ei8t7EdMR9lYPdIYyUdrgg1KPHvv/g0UGUqHtPHFZwbjBiwZYt8dNi0P0bqwrhtt5zIzhE/BGE0cQnj5tAA= 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)(966005)(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: Apsu6kkoSyCUX5jrM8MJt8ugg4KcKBBI66cVz3g4x/Gs88xaqRh74OPNPLxFiJ4ITkXauW4ZCYF3rgiqcDTUTXUYHKR9iRzUDlNCKUpwgNHo0fBkPsvz9LxYUk1XP0GuTmcwuyxRJBV5mQ0QvCIg+GDS1Yg7szaEUrL6HH+nQ4N93dKsL2Rw6xn1pUPvs0ryzVS9FfKjKSFYjxGExH5FVr2FE1IccopGTkhUPIaG8K+qxVjYuctHVhbsLNEzYgay3ZXE1H/9GMFFYuT3GbJN8XeYwroUmqdd5d0v+qBhx3x/V2xlDOoI7Xbwp9qo+MQ7hgukrFatMaRS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X0YHBkAkbEtPUraEKJKMAEw/ypGjHcaTKNw0WDMTTlGC+TExaktU+DW7AuUyVSU/lW5dtX61ogx6XF4zR0bLi/tJzh3DSwVvVxpxrIF5atmDhMWiIc4F+vYe8WUnEEO0Z2Vu2z4SnP13ZBFx3bke6HI70jwCE6Hf+KQLaiEPhlH/fGcEpptlDlPLjTrgEx9DeBLAUjhJ4YB X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10e85b63-5415-4fbc-6677-08dbb83e0d47 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:45.4499 (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: o7sKrrQRgpYReFEEP5xNNIgoYRtbvxcl66IUsE1b4rrqmxZCAJi7ZDoyDh9YntkIVsAl71RMbdLx+7pJnRefTw== 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:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777347671182561650 X-GMAIL-MSGID: 1777395972650683593 This series fixes some missing clean-up function calls in the error handling of the probe. Patch 1 and 2 fix some similar issues introduced in 2 different commits (hence 2 patches) Patch 3 is an enhancement that creates a common function for cleaning up thunderstrike instances. 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. - Rename err_haptics label to err_ts_create to make the label name more accurate. - 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. Link: https://lore.kernel.org/linux-input/cover.1693070958.git.christophe.jaillet@wanadoo.fr/ Link: https://lore.kernel.org/linux-input/20230918041345.59859-1-rrameshbabu@nvidia.com/ Notes from Rahul: - Thank you so much Christophe for these patches. - Sent v2 without accounting for the fact that thunderstrike_destroy in v1 makes the thunderstrike instance in shield_probe unused. Tested v3 with W=1. Christophe JAILLET (3): HID: nvidia-shield: Fix a missing led_classdev_unregister() in the probe error handling path HID: nvidia-shield: Fix some missing function calls() in the probe error handling path HID: nvidia-shield: Introduce thunderstrike_destroy() drivers/hid/hid-nvidia-shield.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)