From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 077EFC433B4 for ; Sun, 18 Apr 2021 11:19:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2F4661354 for ; Sun, 18 Apr 2021 11:19:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230413AbhDRLUE (ORCPT ); Sun, 18 Apr 2021 07:20:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229652AbhDRLUE (ORCPT ); Sun, 18 Apr 2021 07:20:04 -0400 X-Greylist: delayed 251 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 18 Apr 2021 04:19:36 PDT Received: from haggis.mythic-beasts.com (haggis.mythic-beasts.com [IPv6:2a00:1098:0:86:1000:0:2:1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A9E6C06174A; Sun, 18 Apr 2021 04:19:36 -0700 (PDT) Received: from [81.101.6.87] (port=47136 helo=jic23-huawei) by haggis.mythic-beasts.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lY5OW-0003OH-Ei; Sun, 18 Apr 2021 12:15:17 +0100 Date: Sun, 18 Apr 2021 12:15:43 +0100 From: Jonathan 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: <20210418121519.69588c2b@jic23-huawei> In-Reply-To: <20210418121244.7e26914b@jic23-huawei> References: <20210415185232.2617398-1-srinivas.pandruvada@linux.intel.com> <20210418121244.7e26914b@jic23-huawei> 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 X-BlackCat-Spam-Score: 4 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org On Sun, 18 Apr 2021 12:12:44 +0100 Jonathan Cameron wrote: > 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. And dropped again. Not enough caffeine today. Not in IIO obviously so instead: Acked-by: Jonathan Cameron for both patches. > > 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); >