From mboxrd@z Thu Jan 1 00:00:00 1970 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 65D69EB64D7 for ; Mon, 26 Jun 2023 18:14:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230159AbjFZSOE (ORCPT ); Mon, 26 Jun 2023 14:14:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231303AbjFZSNr (ORCPT ); Mon, 26 Jun 2023 14:13:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E667A1704 for ; Mon, 26 Jun 2023 11:13:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8181860F24 for ; Mon, 26 Jun 2023 18:13:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87B79C433C0; Mon, 26 Jun 2023 18:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687803224; bh=2ByIcyxnN5zggGi9AIVTkb8AfABO0oZ9oy71RHOyZwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q4z0Fsm+clnoVlAU96mwvbmauOb9n6yObhUvLYm0/aediA1XRG+0vzYtaryUHAdvx 34fV6T8rAJ7bNYmcsqhojX6+xBX7XOxsGtq4mNUOE5pgPOxSuiYLJvNEDz6OtcIu0z cOClnopIYUNIsg02VAmNoFIFUoHuHgp2hg+g83P0= 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 4.14 16/26] HID: wacom: Add error check to wacom_parse_and_register() Date: Mon, 26 Jun 2023 20:11:18 +0200 Message-ID: <20230626180734.304965857@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626180733.699092073@linuxfoundation.org> References: <20230626180733.699092073@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 3d521f289984a..28e7a4950b74a 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -2251,8 +2251,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