Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1020650pxb; Thu, 15 Apr 2021 11:53:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwteiaMnIlhSnb6TbK1Jtd0fqwRmo+p8bU2vaEqefuRGn4yrvleziIVEDhLxbGYYFd+6Y/V X-Received: by 2002:a63:79c6:: with SMTP id u189mr4668064pgc.154.1618512802987; Thu, 15 Apr 2021 11:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618512802; cv=none; d=google.com; s=arc-20160816; b=ksMVUel4ztNr3o3/LAPs/Szw7eSQSCAQb5r1pTFyjr71xNzj0HVW55SaaEkZ7Kd+Uw VlagrUdGawP8gSgt5/2F3ko+EyBW80KJtMt3ZawUMjvz8oBOPNPWQkhMbc0a0H9Q4poH MOey6/r3+fSMjRIA4IZ7Gaha9CYzacWmIT97AfOPjovK3nDhIN4Mwvpmpca6SxmdtmkJ R5BWajwnmf83SredwdflLN1xNHgzKym2fySAe5pf/e2qquJ7GwmQdVgEjI+nok8ppYow 9+oB04b39jX5ItLtZeiu954pzDev9DOTlHdOA8Dd8FH+M5l0ZohTAXEY9cgc9PVB7U7+ 0B8A== 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 :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=xijqqi5b2OMXK2FsVqS/Rnm32gddbDpozgcfr2SvJqo=; b=BiAMGNvnzz5UJwpjm8vDER6RXiP2Z4E27dpyXCxlW//ilj7z63OQtIpcSToz3LQKFm JlnCDNQZxPFcnnrif12ydqzmQTWWCCUgwjQJMXZNJYSG3lNLxbOf2BGylyd1PnuSJNt5 zzouQLZoFsKWzgvjGrK+YzSHmlX0IM1AoiaH81FKKHfYUNSFdCZnSFv/vUg0A44kjb/U vQQ05+uUws8JPJGBlOAyMAdHB3vKJEnjRTj34j/QFX+tC/HtLX3VRyCJp/QAQibgZj0t vRtsNkmoiE/2WhOL90QeDDGT9yjTUtZU/sCtXdiprEh2tdMWDLhn7GXBRO2FPAeOttKY pROA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si3825630pgs.138.2021.04.15.11.53.10; Thu, 15 Apr 2021 11:53:22 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234505AbhDOSw7 (ORCPT + 99 others); Thu, 15 Apr 2021 14:52:59 -0400 Received: from mga04.intel.com ([192.55.52.120]:31157 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234101AbhDOSw5 (ORCPT ); Thu, 15 Apr 2021 14:52:57 -0400 IronPort-SDR: XvI4ysctFejX4uyz5VK18NhRSsFJVb7k33FunaIfLnZgx1/d0Pde5HgvvU8JF0qmWv2cSRyQMJ Y5mMsLcCgyHA== X-IronPort-AV: E=McAfee;i="6200,9189,9955"; a="192792351" X-IronPort-AV: E=Sophos;i="5.82,225,1613462400"; d="scan'208";a="192792351" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2021 11:52:34 -0700 IronPort-SDR: WB2x6z6CCoH5XIEzorYma2EX9jtZ2l+8i7JM5jECwf9LC/1rItW8KiDCtEs7hzjz6VxZV7qu7i zPb49kjLhHeA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,225,1613462400"; d="scan'208";a="384108663" Received: from spandruv-desk.jf.intel.com ([10.54.75.21]) by orsmga006.jf.intel.com with ESMTP; 15 Apr 2021 11:52:33 -0700 From: Srinivas Pandruvada To: jikos@kernel.org, jic23@kernel.org, benjamin.tissoires@redhat.com Cc: jiapeng.chong@linux.alibaba.com, linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure Date: Thu, 15 Apr 2021 11:52:31 -0700 Message-Id: <20210415185232.2617398-1-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the function sensor_hub_set_feature(), return error when hid_set_field() fails. Signed-off-by: Srinivas Pandruvada --- 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 3dd7d3246737..f9983145d4e7 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -210,16 +210,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.27.0