Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3812106pxv; Mon, 28 Jun 2021 13:33:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4KznHQs5UUbxBUP1pRgaL2ZU1StUwqRvq7S0Nr4UYSVlBdyDDG92f98k2vMQl3X72csLl X-Received: by 2002:a02:a391:: with SMTP id y17mr1237330jak.5.1624912385237; Mon, 28 Jun 2021 13:33:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624912385; cv=none; d=google.com; s=arc-20160816; b=plqzs/XiS8m5JxNKnzw7rRM4U29OutW6BjnIGpH0rSmn7H78BPeF8BKzeynfZPaxSi w8v40rwvbI9nML5qcTRVpZAFw82S790yNxjRG4lBJjXPxuUljieqjikrbAvc8JdEchng pn7HvYAtYCQkLreH+iTB7g3LX118mn4/ceilM7y2C57pYjGCro7vH8FkUZC6Lp7//aih xMXTGZavT+KLoSZj0+wx4NSsWIQM+w3UAOCaobRhZGDPnoOrDubaaruHl2eqgCDmCySB yDnfjgpGu1YHmC/7DY5XFLXu/t56NIbpb6+SAvNyXT1b7SivEH10teZ7vnKCjGCEvkik 5vTg== 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=fQbGYbhCjposDbbeCnu8BqWhIYCGr2ZtYlFlbvVfBGE=; b=uICopXaRlGj/DZ0SYFveUDBq+ARLWwBKlp/a2wDVGmj6ZOOcHHRjpUaJLRw28CXJA3 bIIW7w21etgmxyGIKv0ZtmhOngwn8Os6/J7sW61jxNHKrQgODCb9vYAz+BJYZkiyDGW9 izg9Tip0OizRPF9O9rtX+laeXX9hUP6glapBXCME5Ka2hjnoWQ+2jigpw5VKgieWNxA0 ju5le6TsxB4iNxZyB7kTckhHJwboGPtJWDPynUuRbm4Ta/2iEAMG4UlT0yrb1nQa/kUf Sso+TJ1cKu8fEyTbS/5DjzJmc2i59A+TOMbPtZVFLWhwJhIZ1cEpNurnLVFWY2ymf3Bl wIvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gjbufWvO; 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 p31si20640665jac.95.2021.06.28.13.32.52; Mon, 28 Jun 2021 13:33:05 -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=gjbufWvO; 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 S235419AbhF1PGv (ORCPT + 99 others); Mon, 28 Jun 2021 11:06:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:54482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236307AbhF1OrN (ORCPT ); Mon, 28 Jun 2021 10:47:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 45A3B61C9C; Mon, 28 Jun 2021 14:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624890992; bh=PSeUHXyNu4/zMavba5976xT+dMH+3+5S0oxbo9sJw4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gjbufWvOjCib5wBj/tqp8CZ9Q+rIuT+jKhVXL8OGU8OkqI3W7zafXIK3jSNaLiEB4 Pk9wGvhKdsqdy+806pyuFiORGj5dGMG8iKekXK9THnfr4jmsciBY0nXY2PuXQAuGej 9LgfDTQfVz7HIYfViILBnu9EizBPl9nqNRTMCs1hGpLmpuGQgFmnJBTa5TR54y6HY2 9lGsWDBh+fW5l08DY1Trsg48X73ujEk6yAHdSZaU4pp+60liBfXDx96O60XBnMI0ER r5K9c4UBtQNmeAnl3sxcTTyAbgOuvJUuYhbK1DyafHOC7K88czRWmfj/NasRwz33b2 vO49K1Z8gDg9Q== 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.14 02/88] HID: hid-sensor-hub: Return error for hid_set_field() failure Date: Mon, 28 Jun 2021 10:35:02 -0400 Message-Id: <20210628143628.33342-3-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628143628.33342-1-sashal@kernel.org> References: <20210628143628.33342-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.238-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.238-rc1 X-KernelTest-Deadline: 2021-06-30T14:36+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 aa078c1dad14..6c7e12d8e7d9 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