Re: Move panel driver out of staging?

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

 



On Mon, Dec 28, 2015 at 12:32:39PM +0100, Ksenija Stanojević wrote:
> Hi Willy,
> 
> I'm helping Greg do a bit of cleanup in the staging tree, I noticed that
> panel driver is maybe ready to be moved to drivers/misc. Are there any
> TODO tasks left to do? I already sent checkpatch clean-up patches.
> 

I feel like lcd_write_data() should take a u8 instead of an int.  Or
possibly a char, I suppose.

Could we tighten the checking in input_name2mask() a bit?

drivers/staging/panel/panel.c
  2044  static int input_name2mask(const char *name, pmask_t *mask, pmask_t *value,
  2045                             char *imask, char *omask)
  2046  {
  2047          static char sigtab[10] = "EeSsPpAaBb";
  2048          char im, om;

Om is 8 bits (signed or not depending on the arch).

  2049          pmask_t m, v;
  2050  
  2051          om = 0ULL;
  2052          im = 0ULL;
  2053          m = 0ULL;
  2054          v = 0ULL;
  2055          while (*name) {
  2056                  int in, out, bit, neg;
  2057  
  2058                  for (in = 0; (in < sizeof(sigtab)) && (sigtab[in] != *name);
  2059                       in++)
  2060                          ;
  2061  
  2062                  if (in >= sizeof(sigtab))
  2063                          return 0;       /* input name not found */
  2064                  neg = (in & 1); /* odd (lower) names are negated */
  2065                  in >>= 1;
  2066                  im |= BIT(in);
  2067  
  2068                  name++;
  2069                  if (isdigit(*name)) {
  2070                          out = *name - '0';
  2071                          om |= BIT(out);
                                ^^^^^^^^^^^^^^
out is 0-9 so it's too much for "om".  I don't know if this causes a
problem, but let's remove the question by adding a check for illegal
values.
			if (*name >= '0' && *name <= '7') {


  2072                  } else if (*name == '-') {
  2073                          out = 8;
  2074                  } else {
  2075                          return 0;       /* unknown bit name */
  2076                  }
  2077  
  2078                  bit = (out * 5) + in;
  2079  
  2080                  m |= 1ULL << bit;
  2081                  if (!neg)
  2082                          v |= 1ULL << bit;
  2083                  name++;
  2084          }
  2085          *mask = m;
  2086          *value = v;
  2087          if (imask)
  2088                  *imask |= im;
  2089          if (imask)
  2090                  *imask |= im;
  2091          if (omask)
  2092                  *omask |= om;

It's too much for omask also.

  2093          return 1;
  2094  }

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux