Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3031331rwb; Mon, 15 Aug 2022 16:30:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR4NpvJT+3gVfjk9euEgbOewRKK26nuh6f5iXMZHTaLKR0ZxFOT2vt0SCsvRH+/UtnMITip3 X-Received: by 2002:a17:907:eaa:b0:730:c780:f71e with SMTP id ho42-20020a1709070eaa00b00730c780f71emr11197335ejc.770.1660605867462; Mon, 15 Aug 2022 16:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605867; cv=none; d=google.com; s=arc-20160816; b=NiCO/WWxhQWmvAwp9e44wWBLyBLZyW+WoRFhc8YfTMgLgastF8OnEJxJRLQn0hAbWu O8BhhK+3EDeHuI6SMh/QG+drI+ZM/BGHcukiLMij+ptb3k5lp3YUP+8UExpNhrjWiLGV ERRuDLjFmh6cwAN8HMH28mmqRDjwbwWhKchyEbpIc9iR97dWjMxd0Ri1sUPsnAorm0sx jsl1ZxaaH0z4QLOnaINbkqqXr4Bz3SeanwUPvUOccFi6IMg+RuWQtcylOSEZGL6lE5m7 VL11wmRe2TZ88vMaPS9+AHKSCnHr/56vLj8wUay91+dDtEBgzaHS+lSTyqgw8Q8BPdFD DvWA== 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=wClutnKIBkJgiLa7FqiqMTpd1MOayb9PYzNS87r1HXo=; b=PVRyKi6lEO7Qt1/NukuyDARr1XR4RSgSysTM5kFlObLndRWa5dGpgDmIbASaMKFO6k YLeV2wj+NjGxSUQwqlD/CZO4OjHGOYsN7D58Am8aOGQtKr7HNmetOsVxRxX8ZgHFgJ81 qHwZmuAJUoQBx77GZpu8KWKUsvdcWDIB+I0YpokRbppbrPQJaQpGLal1RTl7C+3fl+yc y2lfu9UJ5D+CiKMFHolyLvtWG+C+mL/HX0sarSIl9TC5tBQlXAAPS6ku+pOsOONyRPJh 9e7huiuS0VmdSMzBW0I/79QXY3ccOf1tOTLMVmBvJnY4D1khObaTnvmMuTh0TKoSIJQu xQ8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iSBhOUAS; 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 h2-20020a1709060f4200b00734c5ab8514si7525028ejj.151.2022.08.15.16.24.02; Mon, 15 Aug 2022 16:24:27 -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=iSBhOUAS; 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 S1349702AbiHOWbF (ORCPT + 99 others); Mon, 15 Aug 2022 18:31:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349656AbiHOW0D (ORCPT ); Mon, 15 Aug 2022 18:26:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 659F4127BD0; Mon, 15 Aug 2022 12:44:47 -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 E96076120F; Mon, 15 Aug 2022 19:44:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D855AC433D6; Mon, 15 Aug 2022 19:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592686; bh=CUjDrPTV27jSN1ucbZYKPwsC8fO7x4ZEi5LF9MQZtMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iSBhOUASLJMzHBlOawaoIeI+YyGsl3wsvfXrX2vW/DrMDd+IW052Rij1tAaezuBAj TFAUGkHtE40KSUHMvUY4hltWyFwOcbb+0kl3Rfaipif2u4grFdQbGtNXfd5EJmWAEN MrU7EugjD1zMTGOoxV/oQV/8Ufemrw3UF3nVF5gE= 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.18 0792/1095] HID: amd_sfh: Handle condition of "no sensors" Date: Mon, 15 Aug 2022 20:03:11 +0200 Message-Id: <20220815180502.004422365@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 444acd9e2cd6..8be33cf3b6c2 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c @@ -155,6 +155,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