From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FE29C8E5 for ; Mon, 26 Jun 2023 18:41:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8282FC433C8; Mon, 26 Jun 2023 18:41:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687804891; bh=20h86SF8vqjjV7pZqhVFq96wt0LfBRYx5d1gMdmcW4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CS9wa3vxYUTKT1we1Q9tpX7FGYiLYBOjvoyaiOf39WEiNcmCslk7Mj4ihFYjuwAEe Klv0PoIAK4EZ0cU83D+OnChe7QurzYSJ1mBS8M+kX62vsKniozEqvqWxZbca5fW/js 7HwQ2Zg/QU0FKppHDrkLSIveFpSDmDibxGn4W1eg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Denis Arefev , Ping Cheng , Jiri Kosina , Sasha Levin Subject: [PATCH 5.15 77/96] HID: wacom: Add error check to wacom_parse_and_register() Date: Mon, 26 Jun 2023 20:12:32 +0200 Message-ID: <20230626180750.205987604@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626180746.943455203@linuxfoundation.org> References: <20230626180746.943455203@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Denis Arefev [ Upstream commit 16a9c24f24fbe4564284eb575b18cc20586b9270 ] Added a variable check and transition in case of an error Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Denis Arefev Reviewed-by: Ping Cheng Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/wacom_sys.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index d29773a799b4f..33e763e746a0b 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -2425,8 +2425,13 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless) goto fail_quirks; } - if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) + if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) { error = hid_hw_open(hdev); + if (error) { + hid_err(hdev, "hw open failed\n"); + goto fail_quirks; + } + } wacom_set_shared_values(wacom_wac); devres_close_group(&hdev->dev, wacom); -- 2.39.2