Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3777068pxv; Mon, 28 Jun 2021 12:35:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIuHGJPDTiqa4survkcYb3xROkDuSUl0IAyPzC91S1lZwQFIFW2+L4HXU4fAR4m5vMkcqv X-Received: by 2002:a05:6e02:8af:: with SMTP id a15mr13590721ilt.307.1624908957767; Mon, 28 Jun 2021 12:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624908957; cv=none; d=google.com; s=arc-20160816; b=xng5sScVh+V+uvsYTZD6Tyr+Kf+HQHfasFkDyv+dfTGOz2IgTXxUsIVFS9620C6kiG Hj4zR/Qekbdlnkxg3489+VA2uTjBuhOC4hxTHL3YKRpXs37NSZagvbiAkR0FnB+RRftn Q8JqkLXeiaeqSRUT4P4El8SV7sw6wjBw1wNBcGphmVoMC2szJD69an0Is96OysNWVoe4 CrEJQEVzWSVV0+SM4t13TQIMuhQQ6HwMNvjH2PrVdpcfZxNDeBwieDYOJCvyxLH/C3nU 4IvqvPPz7M16LXQJad9CsYe8T+40P9OiJCdo7o92wRYOcJYNrFZjIneGGQeIn9NqbJJN orkw== 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=k74zosnT+ztABN2F78/l+kvYhXMmuwTPWD/MVvs/wUk=; b=TqBXyRICDzZnoYJkl+0ChviI3M/F12grioIsfmJUP13D8pIwIOH+1KqrET6B27vdyc 5h0jyrmGL2fuBs/Fc5o8Ph16v9DdYE7smTdGUveM8IH6PClMcwoA3THA35Q616pcTWdl CoNXUNFquHyw0Q9/bCPh4pws312LSTUiiAwxS6FoL5b7ETmNToBUkGzBeSLlqHrKbbcJ 2pU6SJpc9M+URsm1GBL0HabggdQWX5tLhJolQerBwDiRGxDDXZUAbt6tlsp0DgEmN/iw gQGmOCa11F7At2he6vDS+HdmrTTHMjOLpTfxD6tBJgJreSI3eZpkce7wf3OfIaSp0SQE Ooog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ToQTzRXW; 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 h6si20117687ilr.53.2021.06.28.12.35.44; Mon, 28 Jun 2021 12:35:57 -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=ToQTzRXW; 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 S234969AbhF1OxG (ORCPT + 99 others); Mon, 28 Jun 2021 10:53:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:43572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235364AbhF1Ojx (ORCPT ); Mon, 28 Jun 2021 10:39:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E7A6D61C77; Mon, 28 Jun 2021 14:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624890790; bh=Xxu1GXIuEAn9iK7BKOtVUnfRz/LmbSEDUzga1/oJ9sQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ToQTzRXWCupOJJSUEFq2b9ypvJXffb0rfC4yv6ShBoUjoL4YGOU4PZKhcGqUUFILl T9MeRmiPDBzvHuXntfIZZRPy4h5Y6iMnURfkWMmMQ/oaQHyD6eC+maM0PsXyGR7Qiq zsiVkVE6hUTwUWCUB354KNL2hItYSeb8FPpJF1jTOcb6uirGDXzpvCpZD3UqD30OZ9 Exuk14OVV0WUTd3S2VdJcfMnYWfK5ulBLodMfbJsB4MccQM/prHqMzHKtvexbxvmHX LWw/Cq1HOA3MNQF82jh9ncS7Fg0tTFMHZzWlcAkqvIO4HC3EC6io/oVsWgN23FJAnQ ebrJ4fa7VxcWg== 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.19 003/109] HID: hid-sensor-hub: Return error for hid_set_field() failure Date: Mon, 28 Jun 2021 10:31:19 -0400 Message-Id: <20210628143305.32978-4-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628143305.32978-1-sashal@kernel.org> References: <20210628143305.32978-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.196-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.19.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.19.196-rc1 X-KernelTest-Deadline: 2021-06-30T14:32+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 21fbdcde1faa..ef62f36ebcf9 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