From patchwork Sat Aug 26 17:42:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13366637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1435EC83F11 for ; Sat, 26 Aug 2023 17:43:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230194AbjHZRmg (ORCPT ); Sat, 26 Aug 2023 13:42:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbjHZRma (ORCPT ); Sat, 26 Aug 2023 13:42:30 -0400 Received: from smtp.smtpout.orange.fr (smtp-21.smtpout.orange.fr [80.12.242.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE2A810F for ; Sat, 26 Aug 2023 10:42:27 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id ZxInqYKe17qfuZxInqGrPq; Sat, 26 Aug 2023 19:42:26 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1693071746; bh=orB9jPwaecPFP/gpzbrOrsYdsANF2oVXr2ZGkrw1kio=; h=From:To:Cc:Subject:Date; b=NJHc2LnPPCsJoZ1Ueo2HFkPUULSxF3IPHkgQ5KDAT1lAynfkoQtFBKjg/+3bE9/Ca dWS4w5bcD09zfugdsG+HqBMefh6RCcoBDNPI+SBVZcV/jniTspdwtb/8lpxHOjaYig VIDQbCYsLFkmjOFc2p04DIB8GB53BRUsoIAQL17N47Ot7kTagsICH0I0VbMRTZZ66y 8Xu+pxLOvrLCGULDZYu44PZStavJJ6ISh39DPqzCsVZOTyakYXKbvO2m64DtqC5YRq lSQkn+pOTv3CgOyMS+oQn6ohPAIA2EQL0kW6z90zc1ZCgZiZQSQxszIdqzo86qyGDp lK07r7YBaZ/UA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 26 Aug 2023 19:42:26 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: rrameshbabu@nvidia.com, jikos@kernel.org, benjamin.tissoires@redhat.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 0/3] HID: nvidia-shield: Fix the error handling path of shield_probe() Date: Sat, 26 Aug 2023 19:42:16 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This serie 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 a proposal to be more future proof. *Note*: I'm not 100% sure that the order of the functions is the best one in thunderstrike_destroy(), but it is the way it was. My personal preference would be to undo things in reverse order they are allocated, such as: 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); This order was explicitly chnaged by 3ab196f88237, so, as I can't test the changes on a real harware, I've left it as-is. 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 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)