Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1198855pxb; Sun, 11 Apr 2021 10:45:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTwQb5bXJXAclFB5Z3UCMQyM4mNDqD5SdI7YIWrGMU0KxWTi6QA4sdm13bYx0dCdwPm9fL X-Received: by 2002:a62:2d6:0:b029:204:9b3b:dced with SMTP id 205-20020a6202d60000b02902049b3bdcedmr21681041pfc.36.1618163105142; Sun, 11 Apr 2021 10:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618163105; cv=none; d=google.com; s=arc-20160816; b=ewQxrJH2UKYwv886az9J0jLRngj3+Nm9Zm+saVCbeVtZ71+TBpyqyeAkeISND5/nqB mDwmUcHsIE7V8h0IT7NqCw8D+AJSjYTmnOtdVZTp3/kU+9+iVvRYMHwFL1+gcSe06JZm 6MNh7CVRbkAfPJX1lNxNQq23TErkaZetyJ+tYLffTfo+nylirBdHq84k6JM0ym6G90TB fX7c5rkQK7efyWYYjza6TyaNRJLCM0EyOT1BI8fhmdY/2Fug8MXX9hjdbI5aQPM5NZ1P 7vnCv7MlrMBpAtIplHxkCARJ3b0VgWkroSnmceFVORI6MJ4UkcsMcM59ILu/40/o0eF3 gi7Q== 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=fdpuqKwPWN1jN/MDmivMaL9QURy57DYlfub85AXBQwU=; b=sJEO5vOgX1seBcKvIyzopcZFAcAJsgW372cOw+Xh/u58nTwtIcAbNJTbke+ZvJL8Y/ oXX1ySpMDVYG+xF3w7/DSn3E9/E4GVg7/bt9vWVXm7nHVQV/QFbcSyPPUkocj8pgViCw gtkTRa8LpnzY0La1S+1xusT+WybVysMVPQyrTqC802MbIodu0xCsSo0kuUXJQa3joeui FKhgyecnrmCn0J46kRrw85RB3bx32wieZFiibwFaYzyoKaj0Nys6OYPSdZbzmQiUMIWb Q/vN/EYTYBBUmUbFoMfOt58SZFtRO/sUBItOGmZG3RpfJPGsotGI7MzjEc1n9sbepG56 S/vA== 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 h14si10885039pgk.471.2021.04.11.10.44.51; Sun, 11 Apr 2021 10:45:05 -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 S236394AbhDKQGy (ORCPT + 99 others); Sun, 11 Apr 2021 12:06:54 -0400 Received: from mga05.intel.com ([192.55.52.43]:63433 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236336AbhDKQGx (ORCPT ); Sun, 11 Apr 2021 12:06:53 -0400 IronPort-SDR: f9upS+UTTlOInoyyfcuCvJeGYCU+CHF/OxnYQt9UWhjQiNfdqPdUlUxb7YvTSC1A643H7CM3yo OZB0xCu8Ilgg== X-IronPort-AV: E=McAfee;i="6000,8403,9951"; a="279339599" X-IronPort-AV: E=Sophos;i="5.82,214,1613462400"; d="scan'208";a="279339599" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2021 09:06:36 -0700 IronPort-SDR: muuYQBEec/nm4lJTFq5kEdfvwsFQ3Xli2/vfZ5JI0OkN+3BmshVlST9fseMmIbl4DNYzId3+wj +1EMe0+Mmk+A== X-IronPort-AV: E=Sophos;i="5.82,214,1613462400"; d="scan'208";a="417033834" Received: from eunsohlk-mobl1.amr.corp.intel.com ([10.212.186.19]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2021 09:06:36 -0700 Message-ID: Subject: Re: [PATCH] HID: hid-sensor-custom: remove useless variable From: Srinivas Pandruvada To: Jonathan Cameron Cc: 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: Sun, 11 Apr 2021 09:06:35 -0700 In-Reply-To: <20210411145635.3c6b48d1@jic23-huawei> References: <1617952508-47150-1-git-send-email-jiapeng.chong@linux.alibaba.com> <4079bb49a9c0022603abeffcdaec32208f449e51.camel@linux.intel.com> <20210411145635.3c6b48d1@jic23-huawei> 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 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 > 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. 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; > > >