Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp808769rwi; Wed, 19 Oct 2022 03:17:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6O+sm60vuoTeDFs0DQNLikqPjjTGqKhqs68bMfuTZtKJ4IV1gfEnjqawFgxLhG4nwDYkJ6 X-Received: by 2002:a17:907:608a:b0:791:9dbc:cc11 with SMTP id ht10-20020a170907608a00b007919dbccc11mr5632022ejc.357.1666174632303; Wed, 19 Oct 2022 03:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666174632; cv=none; d=google.com; s=arc-20160816; b=n5D+dCAVqzo98FdAcTE4a7IgnG+2zsSo3+3R6T0LEvnfKKZcyr9/TyLKOTdK1XkOZx qDdMxUouDPbGK9IYRAkx+nX91h79lEyGJbDVYScrL1blFM2T2YPzsdg2wvF3Xgv76Ajh PrWz739rxXF5NCWml8OUbYba7vnFQoj+zD/K8Xyo5nSFQsdSXI5fI0cEr8Zj1SjVcfLt nqmJ4B4rNo29572RWLYOn9jSgV8uwVOrSez1Dfs7DABNzefCE5D47FUWDgUy1pIdtNEo NeppHyYVqZnJ7JD3/xEHl8w2vCzGJS+ARa4t8BysLjb9HszKgiu6UPNPsNVwDjir+56q /Krw== 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=0q0ahai97hwqCA062clLHsz00veBwl6ZR3Ku8XQgST8=; b=f27CKOvmnxZ3HEYlSrurMcpzjmk6J2wk3Ffki8cRoX66fDyWZc5gKHKn4fdcwDtx0p QAYKGDBikKhT6LNILm7Y964Z4Udui8VB2vVuyo9dzEVhk9EX027Ml7XAoHAJcfoNEnPE /PhSPQtfhozJ+lpmBY7ustkKmV7pWt1Hi9i/udvo8WMkZKPRgYVMZ47cLCb725xe6x3S 3VPSYV4+fU5HF1lvbYbmnDdjLokgVOjTRoe5vxNdGNAfokkDuWNCUK8GoYhiuOj8y57M 0qLdn74fi/bZ2rjcc9SaRVuk8Ei1naaqoi6MV0PnCLQzBWuC5NTA/C+Wkycg9lioukFD 8tZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h+3Zc1hz; 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 sg7-20020a170907a40700b00779e6c93108si11673908ejc.598.2022.10.19.03.16.46; Wed, 19 Oct 2022 03:17:12 -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=h+3Zc1hz; 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 S233082AbiJSJRY (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233288AbiJSJOf (ORCPT ); Wed, 19 Oct 2022 05:14:35 -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 0C813222A6; Wed, 19 Oct 2022 02:04:44 -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 084B861777; Wed, 19 Oct 2022 09:04:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17349C433D6; Wed, 19 Oct 2022 09:04:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170264; bh=o+R7vp3HaUWMn4Qd2e2iX6l/NuO9gxH0uX3q7wrEphs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h+3Zc1hzZVjitxpKTkp8rWw7VDMuSn2EjVqRHBTrMXnX5QkFMAmKgYjFx8i5YrU64 Q79jAqe0ug9qFmF9U28f48w1dOpNYzDJyPZxt37y3K7cgs9uB23sfbo7txxoCo6hgY HTHUqctfM4xx89XNZUPKk7oS68MgDR+JlK7vkNy0= 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 6.0 588/862] HID: amd_sfh: Handle condition of "no sensors" for SFH1.1 Date: Wed, 19 Oct 2022 10:31:15 +0200 Message-Id: <20221019083315.959110162@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@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.4 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 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 68266bdcceec10ea364e62c63732cd6fe5a256a8 ] Based on num_hid_devices, each sensor device registers to HID. If "no sensors" then amd_sfh work initialization and scheduling doesn’t make sense and return ENODEV to stop driver probe. Hence add a check for num_hid_devices to handle special case in the situation of "no sensors" for SFH1.1. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Signed-off-by: Basavaraj Natikar Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c @@ -110,6 +110,8 @@ static int amd_sfh1_1_hid_client_init(st amd_sfh1_1_set_desc_ops(mp2_ops); cl_data->num_hid_devices = amd_sfh_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);