Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2541925pxb; Tue, 13 Apr 2021 04:38:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwK+bsy6yQHyTE00KPu1qggaTHqi9tulNR2++biEfQSSrcf/mhRI4yp/FiVlAwgn7lVj5Uo X-Received: by 2002:a05:6402:506:: with SMTP id m6mr33172860edv.157.1618313905097; Tue, 13 Apr 2021 04:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618313905; cv=none; d=google.com; s=arc-20160816; b=FaybexUhMbaV4IFCH6QrfOV4n/1H9wyMWNbjLwIQ0iEFUqrjrFsrM451Veq6zdEPoA fEa6b5ni+HgFzArAAPSqPHqmmURaWw6xR5Fff9ycAhNMnCC9HEH5mvMDOHodurLP/wEK M61hzLTueEa84gVJsxqS2Zg/h5c2+EjD7bvhrr/8zVdmmU1140CRnHDOy7Y3kXBWRt0p tI+d8hG5nCoKEimP/K9TsDTXo033v7Fe+57rcnYP90NOgCJbfJzxAUFFUNXeOJEaRCTV oULZjrZxBg8CvPJOQhu91/NjG5hzrZ4n/nGEvnDgiF/KOSMT4VoqajsNqxKyBPFA6FdX iJvA== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:ironport-sdr:ironport-sdr; bh=F5RhSZ23wQfIpBg12fmzGFQWhcafZz6/xYILhfWSEgw=; b=vuKWMoRHNYJJa03m0LAK+N2WwiLHCs6aOQUkTsk4Y/x+wC+kPj2RQy5WiwCXrPcwTJ coqQMdliTtE1HK29flzdj/xl1Z7fvgNRU2PM0m8MKJv4tUUvEdvbFSKhjzi0RqtkTzG3 766ntt0sZ+tpik11NUzFnRVrXlcIzrJ+42C8GSGfyFhapmTuIYncychjMO8dmga+hgQA zZUwn+i4vODkRXHv+qU8uFRabYesXmpUR0X+ytkoLfeUAgkJJlGeaVq20RFEI3Yyo7Jo RSFwv7wZ2MUI2KjFrkOdbMzBYTVCRo/LVseRFx8f9btfNaZi/vm28h+/2oe27XwZ7btr vhyw== 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 b15si10228076edz.247.2021.04.13.04.38.01; Tue, 13 Apr 2021 04:38:25 -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 S1343722AbhDLW1e (ORCPT + 99 others); Mon, 12 Apr 2021 18:27:34 -0400 Received: from mga09.intel.com ([134.134.136.24]:4362 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343698AbhDLW1d (ORCPT ); Mon, 12 Apr 2021 18:27:33 -0400 IronPort-SDR: dmr2gpNcziaft2lAtz8FzrUGWi4O82ilPK5nZYf+B3rfmHAC8uK/Vo9e9f7OqpMnY1fdxB56fL cQurdDduRUMQ== X-IronPort-AV: E=McAfee;i="6200,9189,9952"; a="194403242" X-IronPort-AV: E=Sophos;i="5.82,216,1613462400"; d="scan'208";a="194403242" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2021 15:27:11 -0700 IronPort-SDR: Ry9iw0SKTQ0K3efJJcq7X3P3Ky2VuQ7yAyv8p8I6gieNe4zJ4V7W9s7qIrfo03Dgk2m5JqQiaM FpVmZdmxVT2g== X-IronPort-AV: E=Sophos;i="5.82,216,1613462400"; d="scan'208";a="451668279" Received: from spandruv-desk.jf.intel.com ([10.54.75.21]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2021 15:27:10 -0700 Message-ID: <56550dd3c63b062efca5fc7d41c2a251e8fc55ba.camel@linux.intel.com> Subject: Re: [PATCH] HID: hid-sensor-custom: remove useless variable From: srinivas pandruvada To: Jonathan Cameron Cc: Jonathan Cameron , Jiapeng Chong , jikos@kernel.org, benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 12 Apr 2021 15:27:03 -0700 In-Reply-To: <20210412112039.00006821@Huawei.com> References: <1617952508-47150-1-git-send-email-jiapeng.chong@linux.alibaba.com> <4079bb49a9c0022603abeffcdaec32208f449e51.camel@linux.intel.com> <20210411145635.3c6b48d1@jic23-huawei> <20210412112039.00006821@Huawei.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-04-12 at 11:20 +0100, Jonathan Cameron wrote: > On Sun, 11 Apr 2021 09:06:35 -0700 > Srinivas Pandruvada wrote: > > > On Sun, 2021-04-11 at 14:56 +0100, Jonathan Cameron wrote: > > > On Fri, 09 Apr 2021 11:19:12 -0700 > > > Srinivas Pandruvada wrote: > > > > > > > On Fri, 2021-04-09 at 15:15 +0800, Jiapeng Chong wrote: > > > > > Fix the following gcc warning: > > > > > > > > > > drivers/hid/hid-sensor-custom.c:400:7: warning: variable > > > > > ‘ret’ > > > > > set > > > > > but > > > > > not used [-Wunused-but-set-variable]. > > > > > > > > > > Reported-by: Abaci Robot > > > > > Signed-off-by: Jiapeng Chong > > > > > > > > > Acked-by: Srinivas Pandruvada < > > > > srinivas.pandruvada@linux.intel.com > > > > > > Perhaps better to return ret if it is non zero? > > > I can't immediately figure out if there is a reason we know that > > > can't > > > happen. > > Only time it can fail when there is no report descriptor or the > > field > > index is >= report->maxfield. > > But since the attribute is registered from the report descriptor > > and > > index, this can't happen. > > But we can enhance sensor_hub_set_feature() to fail when > > hid_set_field() fails. There is one case where field- > > >logical_minimum > > < 0 and value is out of range. > > I'll go with what you think. Apply as is, or handle the > return value because we might at some later date return an error that > can actually happen from here? > I will send you a patch this week to handle error condition. Thanks, Srinivas > Jonathan > > > Thanks, > > Srinivas > > > > > > > Jonathan > > > > > > > > --- > > > > > drivers/hid/hid-sensor-custom.c | 5 ++--- > > > > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > > > > > > > diff --git a/drivers/hid/hid-sensor-custom.c > > > > > b/drivers/hid/hid- > > > > > sensor-custom.c > > > > > index 2628bc5..e430673 100644 > > > > > --- a/drivers/hid/hid-sensor-custom.c > > > > > +++ b/drivers/hid/hid-sensor-custom.c > > > > > @@ -397,15 +397,14 @@ static ssize_t store_value(struct > > > > > device > > > > > *dev, > > > > > struct device_attribute *attr, > > > > > > > > > > if (!strncmp(name, "value", strlen("value"))) { > > > > > u32 report_id; > > > > > - int ret; > > > > > > > > > > if (kstrtoint(buf, 0, &value) != 0) > > > > > return -EINVAL; > > > > > > > > > > report_id = sensor_inst- > > > > > >fields[field_index].attribute. > > > > > > > > > > report_ > > > > > id; > > > > > - ret = sensor_hub_set_feature(sensor_inst- > > > > > >hsdev, > > > > > report_id, > > > > > - index, > > > > > sizeof(value), > > > > > &value); > > > > > + sensor_hub_set_feature(sensor_inst->hsdev, > > > > > report_id, > > > > > index, > > > > > + sizeof(value), &value); > > > > > } else > > > > > return -EINVAL; > > > > >