Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2849284rwb; Mon, 15 Aug 2022 12:32:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR7cfVm0dALZAkIdzzhbHuqg5cc1g/xFRlFMJW410RN0SYBebRdgo9RUoUj66IVP7YgcxVuT X-Received: by 2002:a17:90b:4f49:b0:1f5:c7c:b565 with SMTP id pj9-20020a17090b4f4900b001f50c7cb565mr30601646pjb.32.1660591973820; Mon, 15 Aug 2022 12:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660591973; cv=none; d=google.com; s=arc-20160816; b=tM5S8npmLTP4vzVtVSEypC+tVK1j3BNvsH0CSQxB2suCLc+ud5MJXkRf8h5ZSYet9T FWzs/265npeICUXqlVrjHAgnOhZxlrqvwfvYTC3ANeBHTMlod1nuiAl9j4DdfrJkemQe p8Jzy4UPvxC+J9fGUHvGjD8OGCR0MjfB2Hhol1d3bCKMewYdRwkQxcSSb1078kpuQj0e 3reDe8XkreARhMy3Fh/g2X7X63b14uZKXQW7KuXB2AICUZ7m3f6SWOHoM/B0wdLEQSPc qe78TxX69ke59OnlzpW0ihUGK9z3zeMXdLBt4lPHoFo8EMOE99YyiFLNrO7Sw9VNPF0n CZdg== 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=OyZR0McUrHWoCijU53J1PfLPL0qm7lDQ5PgjhT4I/Es=; b=ektxoCMd4ngNdtNWbBj/hvwfaF+lsvLpu5AtRtJpJHgQ5s/yY5JM7fzWGgu4pnX8+C 6QFxDmIRt7tZEwCIsPpjkLDg2iKoikwoHyAMp17jHkwrSpyKX61nprFEPEgunb/TH8xu F73Qn5mHsaXytNGJK1vMdSbOb3TNesScT3Fh16tC/BMuuwi2VjqKU+tLaOK858NP0qVP enrk9frEzV9ZiK/xMwhHLu4wnkY2N2WpdbRDB/OhQr46fGUAEA+v13dSeLrcMPnmFju7 l6rz60+p9Kd+3Q+ZNDf3RZhurxux8R7SjK4HKt7pJ7falgYSHQW9mGiV8gIubcK6zrng AoOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lK70HW0f; 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 np16-20020a17090b4c5000b001f50b723b10si19287725pjb.122.2022.08.15.12.32.42; Mon, 15 Aug 2022 12:32:53 -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=lK70HW0f; 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 S1344314AbiHOTbW (ORCPT + 99 others); Mon, 15 Aug 2022 15:31:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344116AbiHOT0X (ORCPT ); Mon, 15 Aug 2022 15:26:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BD3C65E1; Mon, 15 Aug 2022 11:42:20 -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 AAAB460FEE; Mon, 15 Aug 2022 18:42:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADDD4C433D6; Mon, 15 Aug 2022 18:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588939; bh=0nQaV3+rrOhMh1mRySeJDS/Al/3mQd4ZX+OAPi1Dh8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lK70HW0fwLyQvAXnLmVX99kRH6aAqVy1qaZbPTqmk9urSr8PtQzsJutf7HmvwLRPg iCzmYIpX3kmoal0k93KsloMJy7Qp4CvpTOvvRnLHBYH6CGvJJbiTZoR0wCzwjttCFH dhWya5raQEwxZOmaGNC0pBuhc7V/sfydf0VfwlNo= 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.15 530/779] HID: amd_sfh: Handle condition of "no sensors" Date: Mon, 15 Aug 2022 20:02:54 +0200 Message-Id: <20220815180359.938933696@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 6284db50ec9b..ab149b80f86c 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c @@ -154,6 +154,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