Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3864146pxv; Mon, 28 Jun 2021 15:04:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoTHGcJvfLcF+gvEnD8ih2pGcUb7Oa3c28O2CaTI0wU+ZvfNubtfWU8GB6sjZZd0di5IKP X-Received: by 2002:a05:6402:336:: with SMTP id q22mr36224381edw.3.1624917898038; Mon, 28 Jun 2021 15:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624917898; cv=none; d=google.com; s=arc-20160816; b=FqpnF8bOuiwn+4/wBIpRUBHFhWELorQWyF/XTcSaJgbOak3dyX4S7hf+k+xdUVbriL cYCBOC2XmYiIRRH8HPO1pRFvGWxz4QcCOa6rF37fr0gCntaiu42qJAw+r67KqOtbw4y7 m6+RH4LkXYcINBsIApaQIvOuZPiZrpYmlHnK+tbv2u3aeRMvBUAEMfWFsKQDNwNblAoS 0fX/GyugPw91aTTbTnpDPOC4RzOo1h5Czf/M0ZaRNh2erqc6TgPrcWdfvWmlC/vxXuqT VoI/QB1mgObdkvWdl0V3s36wV3AClWB+S0mJJgpeDmxThmpPT9RCgyleXVW8pazQEDTL sZCQ== 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=dTH3SVfzO7M9/Bzkk6wAqvh0ASqoQ08H9DwwI+EL9+A=; b=ZepAsIXyItJrlcwA91+Vml8z+pezEQCW5VBmOLeOUVgKbzZyTw/yNhtfLs4FQ/DML3 KCz2LgItN16scEr4HHWBwhwnAdoTo24Qwd8wjSALmsPLc+uPKfTZ4Dy2SKkhyfqgxF65 sStI0qetPxLT3ycX8K5Tq8CzpuJcUJlw47G18IyX44sBbmx6ozycqDwFk1E6yqcCUZkk xSDHXO265tsTNIBurD+gB8X4idMvdCxdfzsgPLf7/u6inHPquTc/2EwXoIPeDYNsvatC 8bLunAoySfSVRxDeI5nkWjhbPFe3BdgpPDFItPCC75pP1RJxXo3k2x0hfikwv6AAhPDN 3Bmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jvqnlPXE; 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 k21si15356747eds.39.2021.06.28.15.04.33; Mon, 28 Jun 2021 15:04:58 -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=jvqnlPXE; 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 S236057AbhF1PZg (ORCPT + 99 others); Mon, 28 Jun 2021 11:25:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:36480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236663AbhF1PCS (ORCPT ); Mon, 28 Jun 2021 11:02:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0A2CA61C78; Mon, 28 Jun 2021 14:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891379; bh=MK2RLPG3XOilwa4pmuYUNOPAOn+IIYnUet178azp21g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jvqnlPXEiNvD+pXPjjCCdxrTv/lcgBo06wlxUwXwMLW8tmjdaoahGKygyyd3jV1yu wjFCu7wEGQ7ufExQ+QsOj/6JgSufE8siwXoQEfKfTuC+ZCezDTpo813bSQNb0y+/eq 47eRh0PD9k9eZHVutnoRqbSeYOWiu/Mla0o1yRt/aPm/dgJlU+wEOKyuYz2lZuRnJc WihVSl61dj4u4TL1dYCGsN2wyjalyfe34FD2b4emAIUN0acWK6I6kuJOMZp6AxbeoE yOj9Inai0eX7U+L0lWNoDo/mTw/GAg4uWsZwbUcn0hgl9JHb+2BrEfxInkN1sEm6pY Xm+9OSPPr/gIA== 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.4 01/57] HID: hid-sensor-hub: Return error for hid_set_field() failure Date: Mon, 28 Jun 2021 10:42:00 -0400 Message-Id: <20210628144256.34524-2-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628144256.34524-1-sashal@kernel.org> References: <20210628144256.34524-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.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.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.4.274-rc1 X-KernelTest-Deadline: 2021-06-30T14:42+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 83e45d5801a9..ce4e9b34af98 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -222,16 +222,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