Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1494191

Re: [Letux-kernel] [PATCH v3 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation

From Christ van Willegen <cvwillegen@gmail.com>
Newsgroups linux.kernel
Subject Re: [Letux-kernel] [PATCH v3 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation
Date 2016-09-30 18:30 +0200
Message-ID <sn8Rb-4hC-23@gated-at.bofh.it> (permalink)
References <sky5r-3Iu-7@gated-at.bofh.it> <sky5r-3Iu-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

I saw this earlier, but didn't think it important to mention, but:


On Fri, Sep 23, 2016 at 2:41 PM, H. Nikolaus Schaller <hns@goldelico.com> wrote:

> diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
> index 5d0cd51..9a11509 100644
> --- a/drivers/input/touchscreen/tsc2007.c
> +++ b/drivers/input/touchscreen/tsc2007.c

> +                       /* scale ADC values to desired output range */
> +                       sx = (ts->prop.max_x * (tc.x - ts->min_x))
> +                               / (ts->max_x - ts->min_x);
> +                       sy = (ts->prop.max_y * (tc.y - ts->min_y))
> +                               / (ts->max_y - ts->min_y);
> +                       rt = (input->absinfo[ABS_PRESSURE].maximum * rt) /
> +                               ts->max_rt;

If ts->max_rt is zero, or ts->max_x == ts->min_x, or ts->max_y ==
ts->min_y, these yield a division by zero error.

Ofcourse, this is under control of the DT-maintainer(s) of the device
(if I'm not mistaking), but throwing an error on DT parse if (one of)
these condition(s) is met yields better info to the DT-maintainer than
a /0 error...

If you (or others) agree, could you add this to the patch?

Regards,

Christ van Willegen

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-09-23 14:50 +0200
  Re: [PATCH v3 1/8] drivers:input:tsc2007: add new common binding  names, pre-calibration, flipping and rotation Rob Herring <robh@kernel.org> - 2016-09-24 00:50 +0200
    Re: [PATCH v3 1/8] drivers:input:tsc2007: add new common binding  names, pre-calibration, flipping and rotation Sebastian Reichel <sre@kernel.org> - 2016-09-24 02:40 +0200
      Re: [PATCH v3 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-09-24 08:00 +0200
        Re: [PATCH v3 1/8] drivers:input:tsc2007: add new common binding  names, pre-calibration, flipping and rotation Sebastian Reichel <sre@kernel.org> - 2016-09-30 16:20 +0200
          Re: [PATCH v3 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-09-30 16:50 +0200
    Re: [PATCH v3 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-09-24 07:30 +0200
  Re: [Letux-kernel] [PATCH v3 1/8] drivers:input:tsc2007: add new  common binding names, pre-calibration, flipping and rotation Christ van Willegen <cvwillegen@gmail.com> - 2016-09-30 18:30 +0200
    Re: [Letux-kernel] [PATCH v3 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-09-30 18:40 +0200

csiph-web