Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2217782rdb; Sun, 3 Dec 2023 07:24:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeUaf2z8jo80I/Z6u4hZVl7ZJThHAhoAPU4XGeAX/bA8riSQ4/GVPDp6cjJ1r2bzaj201Z X-Received: by 2002:a17:902:dacb:b0:1d0:68a:4a46 with SMTP id q11-20020a170902dacb00b001d0068a4a46mr3404446plx.3.1701617072872; Sun, 03 Dec 2023 07:24:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701617072; cv=none; d=google.com; s=arc-20160816; b=So99nTbTE1g1eZgW+A63fD9ZLqZhYKQ9Mv/5sBwKa8T48NNbHDokUzLy3hUtQTcPvX 1hdESDgH+5FMhHYTTUsu7mz8Ahcg4+VPxzPq9MIviDx1FEhEH8vbBwuiKKeyIZmNY2qw BSqzCjSVIbM1PWltT4kFtDc2kh8AZHoZRUNxI4ZerGW86OPYGA6qNTtBK49pmEVdjMPc P+OTjP9kMOl6ZLQR3dPZXXNS9HhCnhG7jYBSo48u7sprQ7nz/tnZQf9dWHGJ7UVglPBU IrDufGOCbFjOpObSilNalPKtfCMjB7/XIx1LU5FBsePz83F+ucqlQhkHeJB6ADe+4dsH wuSA== 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 Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id q8-20020a170902a3c800b001d05328cf67si4264403plb.472.2023.12.03.07.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 07:24:32 -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 6076D807E416; Sun, 3 Dec 2023 07:24:30 -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 Content-Transfer-Encoding: 8bit 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:30 -0800 (PST) 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 --- 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", -- 2.34.1