Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1699744pxb; Sun, 18 Apr 2021 04:14:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6j1Gxa9W153Yxkn4CI6JGjM4i9PMCGSIEUgzVVxZwqrf79hIBmtBu1b6HyJijlM7czO2n X-Received: by 2002:a63:ee49:: with SMTP id n9mr7199170pgk.3.1618744487523; Sun, 18 Apr 2021 04:14:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618744487; cv=none; d=google.com; s=arc-20160816; b=AkzX3F33+lZMfi/mvCGFlvFfwI8jeDg7fnuD/hQUFu2T/5vUZr/yCNrkCGSgdYMK2G xQGpIulhHnXPFw2nXLtxa31YFwkUqNd80d7QvgMfo7XuSx2kbhmgdSVuMX8THfRXU7yY 24TRKQJy7bLPE5n/FzO9WQPwRFt0/HAogWukouEfSuk1gJSNHf2g1fiECZGApCw/xHDi YzLGQEoTJyXhM0ZOHxj/MzQCiIMXxgSxK8Oj8KENkaLJXlDuozn5JCeNnNmAOxD/0b7m jqagsotmz9A5kPDCukWW0tlGcdnr7StnXPaAnwjme2Be61WFOYnJwWa0PUnweLKMn6TV dXzA== 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:subject:cc:to:from:date; bh=Q1/z7DaCbES948PCCpThB71bOiIqknQAe5z2y1ftt9U=; b=bx6eLjDXU1X14EyX44zwpz4c5VTzCfE6yJAnMNjLm98qP8M9cQWkpuvcCeXQ1eHUNb dU1vPP1/1+UoaXGMq0t+DxamFYNHOX8SEfz0RXVUNIr0QeT7fUgOwYU+ZKfdunS3f3d0 hM+UQSF0v24STANF6pMwfZMfrwenAI9sLVgY1OHsdZSJbnoD2XMbviWhjFFn8GvF22tv lvhp6rzbTgo/Fp7T1VzG0zclBcfnUawgHr9tKzhlBsgUCdKZWTxOKelT5gaddHaHaHTi P5gGS469ocqFkyJqXpkPVRX9G8JKYIXB9SicctC2RfBL2U2wdky6ZNFXPpGXMoZl65Bj LLpA== 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=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 dw6si13337930pjb.26.2021.04.18.04.14.35; Sun, 18 Apr 2021 04:14:47 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236860AbhDRLMp (ORCPT + 99 others); Sun, 18 Apr 2021 07:12:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:44494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236562AbhDRLMo (ORCPT ); Sun, 18 Apr 2021 07:12:44 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3C6CB61001; Sun, 18 Apr 2021 11:12:13 +0000 (UTC) Date: Sun, 18 Apr 2021 12:12:44 +0100 From: Jonathan Cameron To: Srinivas Pandruvada Cc: jikos@kernel.org, benjamin.tissoires@redhat.com, jiapeng.chong@linux.alibaba.com, linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure Message-ID: <20210418121244.7e26914b@jic23-huawei> In-Reply-To: <20210415185232.2617398-1-srinivas.pandruvada@linux.intel.com> References: <20210415185232.2617398-1-srinivas.pandruvada@linux.intel.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Apr 2021 11:52:31 -0700 Srinivas Pandruvada wrote: > In the function sensor_hub_set_feature(), return error when hid_set_field() > fails. > > Signed-off-by: Srinivas Pandruvada Series applied to the to greg branch of iio.git. Note these won't make the coming merge window, so will turn up in next sometime after rc1. thanks, Jonathan > --- > 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);