From patchwork Sun Dec 3 15:24:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 172958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp2284456vqy; Sun, 3 Dec 2023 07:24:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHg//rYLweYD9sNgKFckG73vdORmgP3pzQSzSroG5zzYg/9M1N9e+ygHBUtGdIavRiABhoj X-Received: by 2002:a17:902:7485:b0:1cf:a2aa:23ae with SMTP id h5-20020a170902748500b001cfa2aa23aemr2770335pll.35.1701617068084; Sun, 03 Dec 2023 07:24:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701617068; cv=none; d=google.com; s=arc-20160816; b=0wJcm6S9B/KwJ1C2cUa5gnsTT9EB6Pe6nnh/OBOl6/fH9FimCMjB/pveX8cahMSL2x M/dCma1ggnoFErDNSvBsOp/UhItZ1oRBFGgwVMecMLFUMeOWdORLsB8Qvh3oQFTDDXTd VbUL+F2Hk6tXvJSuTYT5F9TgHuU9Qx54Tqw0tGbYvxM0tQStHvt9iJaq1sUjrtLVNPsl I4885GcXW5pGGZfbPVJ4+Y+iuXq8m1i5pgf2P5aBdmeuDfsTZqm/N0zefvS+oD+/JAyr y49XwfhbxQho3i5ecatYnqKL2DrSPwQ2K6DBfQm3kiMkrZKKcIjd6q+e+FmZCfjX+LHK iNsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=gnbtnIix+v+CGc9OT23ytJpA1uN7CF77J/4touzfKKQ=; fh=MeBmF+8v3AtuTYr90doxQYZaaeHiJHaJy/8tNunAlo4=; b=rIIhxqLa9R1KNeRtDVTq0i2Ca2kG6EZXe0Li9yig9hOzGHLRrU61qbchnImw78M2bt d9wcIN6VehmqCy8o8Wb7WQY1FcajSCnpWofrjddUrqbkfG1pSdyhQ19EfYtgBTNdNwFZ pfXHvgt57YRxJxtSEq/QWSKe7KPcQN+pZShGhT5IK5Btl3scpz+I6NmzhuX/u/bFpKZS /UrV12GsGd6kO29Z/AG0eSHG9XyZYr6jOWtA7lOzf5vejZVYbQupu1E7hLgBMj8WriIn YBUhqsBKkb3elO2pCtyhRfFPnYfbb1INOxGtkTOohug9EX3pfm64o3S/n7CXGVhHcqrK I1gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=IOXgqwrk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id w3-20020a170902a70300b001cc0cd0772dsi6195386plq.86.2023.12.03.07.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 07:24:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=IOXgqwrk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id EC39C808724B; Sun, 3 Dec 2023 07:24:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233386AbjLCPYP (ORCPT + 99 others); Sun, 3 Dec 2023 10:24:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjLCPYO (ORCPT ); Sun, 3 Dec 2023 10:24:14 -0500 Received: from smtp.smtpout.orange.fr (smtp-17.smtpout.orange.fr [80.12.242.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E1B0ED for ; Sun, 3 Dec 2023 07:24:19 -0800 (PST) Received: from pop-os.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id 9oKOre2IUxHPQ9oKOrhoyc; Sun, 03 Dec 2023 16:24:17 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1701617057; bh=gnbtnIix+v+CGc9OT23ytJpA1uN7CF77J/4touzfKKQ=; h=From:To:Cc:Subject:Date; b=IOXgqwrkOp7vaS9xb3U5gr7R2FeAR3ZWsbSp7zExv5vDAHpB52I3PnNrManjYY+LH 45mg7VkT6a9FT5ZSJf/jAtqViJwdajOJH3958WLb7WB/nZicsJ0GF551yUhuDABRAF cublK6HjDKoK79HnEbEod0lWwc0OZHY39VVH3/7pzDk//OEisLXVzzTp2E7LChY06T Avm5Sl6DWWQk/opdnRfwJr2jpsst+2r4l/DecCGiT+EMhjEVP9W60alo+XP449FnZe 3lDvbtfscEFsO8Y+0Zu1zuzGSdfz4Tq158efFYRvtuAe/So/vMCcjC77Dcch9snNLF OrgCzmA5bAyug== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 03 Dec 2023 16:24:17 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Jonas Malaco , Jean Delvare , Guenter Roeck Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Aleksa Savic , linux-hwmon@vger.kernel.org Subject: [PATCH] hwmon: nzxt: Fix some error handling path in kraken2_probe() Date: Sun, 3 Dec 2023 16:24:05 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Sun, 03 Dec 2023 07:24:24 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784274818990172872 X-GMAIL-MSGID: 1784274818990172872 There is no point in calling hid_hw_stop() if hid_hw_start() has failed. There is no point in calling hid_hw_close() if hid_hw_open() has failed. Update the error handling path accordingly. Fixes: 82e3430dfa8c ("hwmon: add driver for NZXT Kraken X42/X52/X62/X72") Reported-by: Aleksa Savic Closes: https://lore.kernel.org/all/121470f0-6c1f-418a-844c-7ec2e8a54b8e@gmail.com/ Signed-off-by: Christophe JAILLET Reviewed-by: Jonas Malaco --- Closes added to please checkpatch, not sure if relevant here. --- drivers/hwmon/nzxt-kraken2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/nzxt-kraken2.c b/drivers/hwmon/nzxt-kraken2.c index 428c77b5fce5..7caf387eb144 100644 --- a/drivers/hwmon/nzxt-kraken2.c +++ b/drivers/hwmon/nzxt-kraken2.c @@ -161,13 +161,13 @@ static int kraken2_probe(struct hid_device *hdev, ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW); if (ret) { hid_err(hdev, "hid hw start failed with %d\n", ret); - goto fail_and_stop; + return ret; } ret = hid_hw_open(hdev); if (ret) { hid_err(hdev, "hid hw open failed with %d\n", ret); - goto fail_and_close; + goto fail_and_stop; } priv->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, "kraken2",