Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3091684rwb; Mon, 15 Aug 2022 17:55:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR7onJAceQ2lFO3qibjJ7cLYiTD9Id3nJGvM/wfPP9//J00wUnBrfBm0cWLjgt/Jlg2R5eNQ X-Received: by 2002:a05:6402:4143:b0:43b:206d:c283 with SMTP id x3-20020a056402414300b0043b206dc283mr16562631eda.381.1660611334697; Mon, 15 Aug 2022 17:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611334; cv=none; d=google.com; s=arc-20160816; b=Qk7GjTXeLEvSrKfbfNwBwrySQAxRFF5WejuD0N5OSgmltgQYkrvY0smakJoOVf+4TO Wjk6izAhMu8rWAzGpR8X/nzaEyYcBaATq1fqJ7D+JCzMJFIiopBLlvoNVg/W64LHM1fJ YrCfm1bHQzvGwa8gpHCXOqd7K63jvMbtAftiirZrr/ks34DRwu+Mcoyw+KlvvtX+n3Ao shpw/R6FMwahIfzRu2Ustk7yotnHqyxYRlEVTJNZ882H2Pqw3s6gFYaW12kx9FM8WZZr RPF+ZbQ69JbG0AamVooOWST9aWccjIC5v1Da2al3ZBOlHAyQzn1LQZfsN+fOisYsvYMg LHlQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ruP/pW1I+XkasWmAnOqlN2fbdkfKR6rjXxS6/8USZ18=; b=CP0yxbFm3V+4HnFVMMU5vzcJHnLnuOAJYD85R5CidJDxOdirMUznomyKtqXf1wZbbM /cpbqVY3+WaD/w5IbOJihG7UHcKwB52Ih5XnibiVYa10irM9l3MxZdWTsNi+mOTrHTBX Fw3b/qGB8MRqDZGm9hVwmbJiJdqPIIo/V707YrqNUWrIeKOGZwWOEPnQAFBaxi0z/Qq9 0gT3Ce223f86KpANZOh8n1Yyqn+sZAlRHfuuXo1H+a2DyTFTvD1hUzBbp+mtyQ2Tg+Uo umQ8qRt6obxxXFXXAFlhadesq36cm/4B/tKg3R7RsXg5FO8rvsIRcfSoAbtUDcJqJRNu DC3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mF4sCLxS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg13-20020a170907a40d00b0073094cc249esi8665060ejc.887.2022.08.15.17.55.08; Mon, 15 Aug 2022 17:55:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mF4sCLxS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245101AbiHPAaH (ORCPT + 99 others); Mon, 15 Aug 2022 20:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351080AbiHPA3O (ORCPT ); Mon, 15 Aug 2022 20:29:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CC7C181C4F; Mon, 15 Aug 2022 13:35:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CEC326120E; Mon, 15 Aug 2022 20:35:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2B26C433D6; Mon, 15 Aug 2022 20:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595707; bh=Ih/6iQhAoZQZ9u2ZnYtMRwIxGHBSliM25XgUUlJTEXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mF4sCLxS2vrBmRxZn1AQ1jhBIaJ3tz/bpmZmJ6FG9lZCiIwHGpYHmUQIOQCUCUw8F QQ1bvr0ZgjXz15702Ic0Y+RqvhBYwsjCzsyxnDGAZZRpnfsOgY387/OYjYhamepAS1 ntT6RytcoYbUpz/frcwSBp+epTN0HLDx3K38ZbgY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Basavaraj Natikar , Jiri Kosina , Sasha Levin Subject: [PATCH 5.19 0849/1157] HID: amd_sfh: Handle condition of "no sensors" Date: Mon, 15 Aug 2022 20:03:25 +0200 Message-Id: <20220815180513.456703773@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Basavaraj Natikar [ Upstream commit 5d4d0f15657535f6a122ab26d47230b5c2b944af ] Add a check for num_hid_devices to handle special case the situation of "no sensors". Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)") Signed-off-by: Basavaraj Natikar Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/amd-sfh-hid/amd_sfh_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c index 0f770a2b47ff..e27ee1871066 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c @@ -173,6 +173,8 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) dev = &privdata->pdev->dev; cl_data->num_hid_devices = amd_mp2_get_sensor_num(privdata, &cl_data->sensor_idx[0]); + if (cl_data->num_hid_devices == 0) + return -ENODEV; INIT_DELAYED_WORK(&cl_data->work, amd_sfh_work); INIT_DELAYED_WORK(&cl_data->work_buffer, amd_sfh_work_buffer); -- 2.35.1