Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3818927pxv; Mon, 28 Jun 2021 13:43:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYdnzUF2xUcrWmTaqkJkDnN7WOcWFbmEmF/XNxIB3h5QpNU+iHbwbk1PAbtB0Omv7/k7Jr X-Received: by 2002:a5d:8994:: with SMTP id m20mr986454iol.117.1624913023758; Mon, 28 Jun 2021 13:43:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624913023; cv=none; d=google.com; s=arc-20160816; b=xWDr3AXZrWoylGK46bbNjy20/Udec04aPoY2PmQNR1wOvhlJ81v2weFyLqBEt0GX5R 3oZvPXYIMR9ZRgcpu39CA4he6WiQwe7rp1PDDFc5EaQ8P4iKVfMDDtapdiYkBYrSiKaH ZDilyQNu4Lf6ltshiQJH7Y1gOCrmQ5v81graANmTePFL78sWqOdBEX/tvWH2Uu0XyGgk pa+E2kh0iccp0e8isK/y8vq11+cQ7+XsbxZCjZVgaFNo3FeZCmna3W5D0NjQTcsGQ74V aJnM5A2AdL6pORqkxRbWSDSk0sJlnUDehvsqnOYyosvCvVXdMUgIXC+SPqgLQJlKiMbR HYKg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rO20uBzd2IuE1ftNKgxbEAmOOXQSM44tn37Q6kxB/9I=; b=OiWuYHDvYaK5iBlFyUoH4tL563p4zJ518RUamZVlQ8GGlgQpGRQLBcWfylLAsCo5HU DY9700wRZbi/E02OKzXV+0VRi0zroOXkOKuQchAQFJnLNm2DHJhTwrSaAoriHeAQ7UpT SaCCdpYqYD01F+TnH1m4dGAYRcYHu3cIcSNZvCGVh52JlkFDTbUXmaVclqEwbd5GT/WL LieKLS9tnVJ+68Op3vVN/Gc5M4pMdvw2bwYnwMvlOWUgU7/GgvEkZVXA9rWlhxOdxv+8 D5qpCUpR9DVMNn2T1KQlHmQOPq0fiIDG30Yxx+LCMfESuDkszfGhPSJQKc6ewUhmiTaH pTqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h9nAIQG9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si20372301ilt.140.2021.06.28.13.43.31; Mon, 28 Jun 2021 13:43:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h9nAIQG9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235563AbhF1PRy (ORCPT + 99 others); Mon, 28 Jun 2021 11:17:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:33276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236718AbhF1Oz5 (ORCPT ); Mon, 28 Jun 2021 10:55:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9D5806141B; Mon, 28 Jun 2021 14:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891207; bh=mmoRBbN8jbnNMclRxAC+IJf3w21VBf1HJgDECfgzels=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h9nAIQG9Ha7XcDQYw4eu4ZGykXdxD/09toglkNiCVNp6TDH81pimXcmPmWpsTbfKI 9poN8i+LCW1+HPUGConJTLDYrpiBvIHDdtW/2glokogf07LqkgzZRLDzjifFt7yVGl Nab+5MXG34ZJDisDlSlCrpjA/to2RD3FdqCihQfV74FyqxidNRXK8mVsyovI4hVGYn njIF38pWfcuGIoTb+KD77w3D6AFbnyJOBvP/8A4/DsHeUjDVSQTfOHgTVQlhZLWC+Z Xk0PZhiLH+10Rs+zjLl/lbYHfXGmy3o1VnCl97igQXG6rzn32+R2ghvsx93Ev++7J/ qRlEY9QKnglKg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Srinivas Pandruvada , Jonathan Cameron , Jiri Kosina , Sasha Levin Subject: [PATCH 4.9 02/71] HID: hid-sensor-hub: Return error for hid_set_field() failure Date: Mon, 28 Jun 2021 10:38:54 -0400 Message-Id: <20210628144003.34260-3-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628144003.34260-1-sashal@kernel.org> References: <20210628144003.34260-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.274-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.9.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.9.274-rc1 X-KernelTest-Deadline: 2021-06-30T14:39+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Pandruvada [ Upstream commit edb032033da0dc850f6e7740fa1023c73195bc89 ] In the function sensor_hub_set_feature(), return error when hid_set_field() fails. Signed-off-by: Srinivas Pandruvada Acked-by: Jonathan Cameron Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-sensor-hub.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 7001f07ca399..4ea18f07c65b 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -223,16 +223,21 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, buffer_size = buffer_size / sizeof(__s32); if (buffer_size) { for (i = 0; i < buffer_size; ++i) { - hid_set_field(report->field[field_index], i, - (__force __s32)cpu_to_le32(*buf32)); + ret = hid_set_field(report->field[field_index], i, + (__force __s32)cpu_to_le32(*buf32)); + if (ret) + goto done_proc; + ++buf32; } } if (remaining_bytes) { value = 0; memcpy(&value, (u8 *)buf32, remaining_bytes); - hid_set_field(report->field[field_index], i, - (__force __s32)cpu_to_le32(value)); + ret = hid_set_field(report->field[field_index], i, + (__force __s32)cpu_to_le32(value)); + if (ret) + goto done_proc; } hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT); hid_hw_wait(hsdev->hdev); -- 2.30.2