* [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure
@ 2021-04-15 18:52 Srinivas Pandruvada
2021-04-15 18:52 ` [PATCH 2/2] HID: hid-sensor-custom: Process failure of sensor_hub_set_feature() Srinivas Pandruvada
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Srinivas Pandruvada @ 2021-04-15 18:52 UTC (permalink / raw)
To: jikos, jic23, benjamin.tissoires
Cc: jiapeng.chong, linux-input, linux-iio, linux-kernel, Srinivas Pandruvada
In the function sensor_hub_set_feature(), return error when hid_set_field()
fails.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] HID: hid-sensor-custom: Process failure of sensor_hub_set_feature()
2021-04-15 18:52 [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure Srinivas Pandruvada
@ 2021-04-15 18:52 ` Srinivas Pandruvada
2021-05-05 12:38 ` Jiri Kosina
2021-04-18 11:12 ` [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure Jonathan Cameron
2021-05-05 12:37 ` Jiri Kosina
2 siblings, 1 reply; 9+ messages in thread
From: Srinivas Pandruvada @ 2021-04-15 18:52 UTC (permalink / raw)
To: jikos, jic23, benjamin.tissoires
Cc: jiapeng.chong, linux-input, linux-iio, linux-kernel,
Srinivas Pandruvada, Abaci Robot
When user modifies a custom feature value and sensor_hub_set_feature()
fails, return error.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
Replaces patch: HID: hid-sensor-custom: remove useless variable
by Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
drivers/hid/hid-sensor-custom.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 2628bc53ed80..58b54b127cdf 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -406,6 +406,8 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
report_id;
ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
index, sizeof(value), &value);
+ if (ret)
+ return ret;
} else
return -EINVAL;
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure
2021-04-15 18:52 [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure Srinivas Pandruvada
2021-04-15 18:52 ` [PATCH 2/2] HID: hid-sensor-custom: Process failure of sensor_hub_set_feature() Srinivas Pandruvada
@ 2021-04-18 11:12 ` Jonathan Cameron
2021-04-18 11:15 ` Jonathan
2021-05-05 12:37 ` Jiri Kosina
2 siblings, 1 reply; 9+ messages in thread
From: Jonathan Cameron @ 2021-04-18 11:12 UTC (permalink / raw)
To: Srinivas Pandruvada
Cc: jikos, benjamin.tissoires, jiapeng.chong, linux-input, linux-iio,
linux-kernel
On Thu, 15 Apr 2021 11:52:31 -0700
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
> In the function sensor_hub_set_feature(), return error when hid_set_field()
> fails.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
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);
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure
2021-04-18 11:12 ` [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure Jonathan Cameron
@ 2021-04-18 11:15 ` Jonathan
0 siblings, 0 replies; 9+ messages in thread
From: Jonathan @ 2021-04-18 11:15 UTC (permalink / raw)
To: Srinivas Pandruvada
Cc: jikos, benjamin.tissoires, jiapeng.chong, linux-input, linux-iio,
linux-kernel
On Sun, 18 Apr 2021 12:12:44 +0100
Jonathan Cameron <jic23@kernel.org> wrote:
> On Thu, 15 Apr 2021 11:52:31 -0700
> Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
>
> > In the function sensor_hub_set_feature(), return error when hid_set_field()
> > fails.
> >
> > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> 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 <Jonathan.Cameron@huawei.com>
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);
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure
2021-04-15 18:52 [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure Srinivas Pandruvada
2021-04-15 18:52 ` [PATCH 2/2] HID: hid-sensor-custom: Process failure of sensor_hub_set_feature() Srinivas Pandruvada
2021-04-18 11:12 ` [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure Jonathan Cameron
@ 2021-05-05 12:37 ` Jiri Kosina
2 siblings, 0 replies; 9+ messages in thread
From: Jiri Kosina @ 2021-05-05 12:37 UTC (permalink / raw)
To: Srinivas Pandruvada
Cc: jic23, benjamin.tissoires, jiapeng.chong, linux-input, linux-iio,
linux-kernel
On Thu, 15 Apr 2021, Srinivas Pandruvada wrote:
> In the function sensor_hub_set_feature(), return error when hid_set_field()
> fails.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Applied this one, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] HID: hid-sensor-custom: Process failure of sensor_hub_set_feature()
2021-04-15 18:52 ` [PATCH 2/2] HID: hid-sensor-custom: Process failure of sensor_hub_set_feature() Srinivas Pandruvada
@ 2021-05-05 12:38 ` Jiri Kosina
2021-05-05 13:28 ` Benjamin Tissoires
0 siblings, 1 reply; 9+ messages in thread
From: Jiri Kosina @ 2021-05-05 12:38 UTC (permalink / raw)
To: Srinivas Pandruvada
Cc: jic23, benjamin.tissoires, jiapeng.chong, linux-input, linux-iio,
linux-kernel, Abaci Robot
On Thu, 15 Apr 2021, Srinivas Pandruvada wrote:
> When user modifies a custom feature value and sensor_hub_set_feature()
> fails, return error.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> Replaces patch: HID: hid-sensor-custom: remove useless variable
> by Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
>
> drivers/hid/hid-sensor-custom.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
> index 2628bc53ed80..58b54b127cdf 100644
> --- a/drivers/hid/hid-sensor-custom.c
> +++ b/drivers/hid/hid-sensor-custom.c
> @@ -406,6 +406,8 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
> report_id;
> ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
> index, sizeof(value), &value);
> + if (ret)
> + return ret;
What tree is this patch against? In my tree, we're not even assigning
sensor_hub_set_feature() return value to anything.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] HID: hid-sensor-custom: Process failure of sensor_hub_set_feature()
2021-05-05 12:38 ` Jiri Kosina
@ 2021-05-05 13:28 ` Benjamin Tissoires
2021-05-06 4:44 ` Pandruvada, Srinivas
0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Tissoires @ 2021-05-05 13:28 UTC (permalink / raw)
To: Jiri Kosina
Cc: Srinivas Pandruvada, Jonathan Cameron, jiapeng.chong,
open list:HID CORE LAYER, linux-iio, lkml, Abaci Robot
On Wed, May 5, 2021 at 2:38 PM Jiri Kosina <jikos@kernel.org> wrote:
>
> On Thu, 15 Apr 2021, Srinivas Pandruvada wrote:
>
> > When user modifies a custom feature value and sensor_hub_set_feature()
> > fails, return error.
> >
> > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> > ---
> > Replaces patch: HID: hid-sensor-custom: remove useless variable
> > by Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> >
> > drivers/hid/hid-sensor-custom.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
> > index 2628bc53ed80..58b54b127cdf 100644
> > --- a/drivers/hid/hid-sensor-custom.c
> > +++ b/drivers/hid/hid-sensor-custom.c
> > @@ -406,6 +406,8 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
> > report_id;
> > ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
> > index, sizeof(value), &value);
> > + if (ret)
> > + return ret;
>
> What tree is this patch against? In my tree, we're not even assigning
> sensor_hub_set_feature() return value to anything.
>
I guess there was a "collision". At roughly the same time I merged
https://patchwork.kernel.org/project/linux-input/list/?series=456269
people were starting to send various patches for the same thing.
Srinivas, either the change in for-next (and probably Linus' master
now) is fine, or could you rebase on top of hid.git?
Cheers,
Benjamin
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] HID: hid-sensor-custom: Process failure of sensor_hub_set_feature()
2021-05-05 13:28 ` Benjamin Tissoires
@ 2021-05-06 4:44 ` Pandruvada, Srinivas
2021-05-13 11:00 ` Jiri Kosina
0 siblings, 1 reply; 9+ messages in thread
From: Pandruvada, Srinivas @ 2021-05-06 4:44 UTC (permalink / raw)
To: jikos, benjamin.tissoires
Cc: jiapeng.chong, linux-input, jic23, linux-kernel, linux-iio, abaci
[-- Attachment #1: Type: text/plain, Size: 2164 bytes --]
Hi Benjamin,
On Wed, 2021-05-05 at 15:28 +0200, Benjamin Tissoires wrote:
> On Wed, May 5, 2021 at 2:38 PM Jiri Kosina <jikos@kernel.org> wrote:
> >
> > On Thu, 15 Apr 2021, Srinivas Pandruvada wrote:
> >
> > > When user modifies a custom feature value and
> > > sensor_hub_set_feature()
> > > fails, return error.
> > >
> > > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > > Signed-off-by: Srinivas Pandruvada <
> > > srinivas.pandruvada@linux.intel.com>
> > > ---
> > > Replaces patch: HID: hid-sensor-custom: remove useless variable
> > > by Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> > >
> > > drivers/hid/hid-sensor-custom.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-
> > > sensor-custom.c
> > > index 2628bc53ed80..58b54b127cdf 100644
> > > --- a/drivers/hid/hid-sensor-custom.c
> > > +++ b/drivers/hid/hid-sensor-custom.c
> > > @@ -406,6 +406,8 @@ static ssize_t store_value(struct device
> > > *dev, struct device_attribute *attr,
> > >
> > > report_id;
> > > ret = sensor_hub_set_feature(sensor_inst->hsdev,
> > > report_id,
> > > index, sizeof(value),
> > > &value);
> > > + if (ret)
> > > + return ret;
> >
> > What tree is this patch against? In my tree, we're not even
> > assigning
> > sensor_hub_set_feature() return value to anything.
> >
>
> I guess there was a "collision". At roughly the same time I merged
> https://patchwork.kernel.org/project/linux-input/list/?series=456269
> people were starting to send various patches for the same thing.
>
> Srinivas, either the change in for-next (and probably Linus' master
> now) is fine, or could you rebase on top of hid.git?
>
Rebased and attached based on top of the latest mainline.
Thanks,
Srinivas
> Cheers,
> Benjamin
>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-HID-hid-sensor-custom-Process-failure-of-sensor_hub_.patch --]
[-- Type: text/x-patch; name="0001-HID-hid-sensor-custom-Process-failure-of-sensor_hub_.patch", Size: 1640 bytes --]
From 461b85d5869bdc2da84df8aced8a181647082ea4 Mon Sep 17 00:00:00 2001
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date: Thu, 15 Apr 2021 11:52:32 -0700
Subject: [UPDATED][PATCH 2/2] HID: hid-sensor-custom: Process failure of
sensor_hub_set_feature()
When user modifies a custom feature value and sensor_hub_set_feature()
fails, return error.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
Updates:
Rebased on top of the latest mainline
drivers/hid/hid-sensor-custom.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 2e6662173a79..32c2306e240d 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -387,7 +387,7 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
int index, field_index, usage;
char name[HID_CUSTOM_NAME_LENGTH];
- int value;
+ int value, ret;
if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage,
name) == 3) {
@@ -403,8 +403,10 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
report_id = sensor_inst->fields[field_index].attribute.
report_id;
- sensor_hub_set_feature(sensor_inst->hsdev, report_id,
- index, sizeof(value), &value);
+ ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
+ index, sizeof(value), &value);
+ if (ret)
+ return ret;
} else
return -EINVAL;
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] HID: hid-sensor-custom: Process failure of sensor_hub_set_feature()
2021-05-06 4:44 ` Pandruvada, Srinivas
@ 2021-05-13 11:00 ` Jiri Kosina
0 siblings, 0 replies; 9+ messages in thread
From: Jiri Kosina @ 2021-05-13 11:00 UTC (permalink / raw)
To: Pandruvada, Srinivas
Cc: benjamin.tissoires, jiapeng.chong, linux-input, jic23,
linux-kernel, linux-iio, abaci
On Thu, 6 May 2021, Pandruvada, Srinivas wrote:
> Rebased and attached based on top of the latest mainline.
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-05-13 11:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 18:52 [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure Srinivas Pandruvada
2021-04-15 18:52 ` [PATCH 2/2] HID: hid-sensor-custom: Process failure of sensor_hub_set_feature() Srinivas Pandruvada
2021-05-05 12:38 ` Jiri Kosina
2021-05-05 13:28 ` Benjamin Tissoires
2021-05-06 4:44 ` Pandruvada, Srinivas
2021-05-13 11:00 ` Jiri Kosina
2021-04-18 11:12 ` [PATCH 1/2] HID: hid-sensor-hub: Return error for hid_set_field() failure Jonathan Cameron
2021-04-18 11:15 ` Jonathan
2021-05-05 12:37 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).