Re: [PATCH v1 4/5] Input: edt-ft5x06 - do not try to allocate too much memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 06, 2020 at 05:08:37PM -0800, Dmitry Torokhov wrote:
> On Tue, Mar 03, 2020 at 08:09:16PM +0200, Andy Shevchenko wrote:
> > When mode switch happens we try to allocate too much memory in case
> > when num_x and num_y are being assigned to their maximum.
> > 
> > Since the resolution should come from property in such case, reassign
> > values back to num_x and num_y to prevent too much memory allocation.

> > +	if (tsdata->num_x == U16_MAX && tsdata->prop.max_x &&
> > +	    tsdata->num_y == U16_MAX && tsdata->prop.max_y) {
> > +		/* Reassign num_x and num_y from properties */
> > +		tsdata->num_x = tsdata->prop.max_x;
> > +		tsdata->num_y = tsdata->prop.max_y;
> 
> No. num_x and num_y reprsenet number of electrodes on a given axis and
> we should not be assigning maximum coordinates to them.

Thank you for explanation.

> Moreover, the factory mode can only be activated on M06, where we do
> read these values from registers, so we will not be allocating too much
> memory. If anything, we should add error handling for
> edt_ft5x06_register_read() when trying to fetch num_x and num_y.

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux