From: Nelson Castillo <[email protected]>

For consistency the group filter should return samples if it is the last
filter in the chain. It is useful when you want to check what the filter
does.

Signed-off-by: Nelson Castillo <[email protected]>
---

 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/ts_filter_group.c 
b/drivers/input/touchscreen/ts_filter_group.c
index 80e6677..73e3625 100644
--- a/drivers/input/touchscreen/ts_filter_group.c
+++ b/drivers/input/touchscreen/ts_filter_group.c
@@ -182,8 +182,6 @@ static int ts_filter_group_process(struct ts_filter *tsf, 
int *coords)
                tsfg->range_max[n] = v[best_idx + best_size - 1];
        }
 
-       BUG_ON(!tsf->next);
-
        for (i = 0; i < tsfg->N; ++i) {
                int r;
 
@@ -197,10 +195,14 @@ static int ts_filter_group_process(struct ts_filter *tsf, 
int *coords)
                if (n != tsfg->tsf.count_coords) /* sample not OK */
                        continue;
 
-               r = (tsf->next->api->process)(tsf->next, coords);
-               if (r)  {
-                       ret = r;
-                       break;
+               if (tsf->next) {
+                       r = (tsf->next->api->process)(tsf->next, coords);
+                       if (r)  {
+                               ret = r;
+                               break;
+                       }
+               } else if (i == tsfg->N - 1) {
+                       ret = 1;
                }
        }
 


Reply via email to