Hi Gustavo,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on arm-soc/for-next]
[also build test ERROR on v4.20 next-20190103]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:    
https://github.com/0day-ci/linux/commits/Gustavo-A-R-Silva/Fix-NULL-pointer-dereference-and-use-struct_size/20190105-033105
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git for-next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   arch/arm/mach-integrator/impd1.c: In function 'impd1_probe':
>> arch/arm/mach-integrator/impd1.c:392:32: error: 'struct lm_device' has no 
>> member named 'deva'; did you mean 'dev'?
       lookup = devm_kzalloc(&dev->deva,
                                   ^~~~
                                   dev

vim +392 arch/arm/mach-integrator/impd1.c

   320  
   321  /*
   322   * As this module is bool, it is OK to have this as __ref() - no
   323   * probe calls will be done after the initial system bootup, as devices
   324   * are discovered as part of the machine startup.
   325   */
   326  static int __ref impd1_probe(struct lm_device *dev)
   327  {
   328          struct impd1_module *impd1;
   329          int irq_base;
   330          int i;
   331  
   332          if (dev->id != module_id)
   333                  return -EINVAL;
   334  
   335          if (!devm_request_mem_region(&dev->dev, dev->resource.start,
   336                                       SZ_4K, "LM registers"))
   337                  return -EBUSY;
   338  
   339          impd1 = devm_kzalloc(&dev->dev, sizeof(struct impd1_module),
   340                               GFP_KERNEL);
   341          if (!impd1)
   342                  return -ENOMEM;
   343  
   344          impd1->base = devm_ioremap(&dev->dev, dev->resource.start, 
SZ_4K);
   345          if (!impd1->base)
   346                  return -ENOMEM;
   347  
   348          integrator_impd1_clk_init(impd1->base, dev->id);
   349  
   350          if (!devm_request_mem_region(&dev->dev,
   351                                       dev->resource.start + 0x03000000,
   352                                       SZ_4K, "VIC"))
   353                  return -EBUSY;
   354  
   355          impd1->vic_base = devm_ioremap(&dev->dev,
   356                                         dev->resource.start + 0x03000000,
   357                                         SZ_4K);
   358          if (!impd1->vic_base)
   359                  return -ENOMEM;
   360  
   361          irq_base = vic_init_cascaded(impd1->vic_base, dev->irq,
   362                                       IMPD1_VALID_IRQS, 0);
   363  
   364          lm_set_drvdata(dev, impd1);
   365  
   366          dev_info(&dev->dev, "IM-PD1 found at 0x%08lx\n",
   367                   (unsigned long)dev->resource.start);
   368  
   369          for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) {
   370                  struct impd1_device *idev = impd1_devs + i;
   371                  struct amba_device *d;
   372                  unsigned long pc_base;
   373                  char devname[32];
   374                  int irq1 = idev->irq[0];
   375                  int irq2 = idev->irq[1];
   376  
   377                  /* Translate IRQs to IM-PD1 local numberspace */
   378                  if (irq1)
   379                          irq1 += irq_base;
   380                  if (irq2)
   381                          irq2 += irq_base;
   382  
   383                  pc_base = dev->resource.start + idev->offset;
   384                  snprintf(devname, 32, "lm%x:%5.5lx", dev->id, 
idev->offset >> 12);
   385  
   386                  /* Add GPIO descriptor lookup table for the PL061 block 
*/
   387                  if (idev->offset == 0x00400000) {
   388                          struct gpiod_lookup_table *lookup;
   389                          char *chipname;
   390                          char *mmciname;
   391  
 > 392                          lookup = devm_kzalloc(&dev->deva,
   393                                                struct_size(lookup, 
table, 3),
   394                                                GFP_KERNEL);
   395                          if (!lookup)
   396                                  return -ENOMEM;
   397  
   398                          chipname = devm_kstrdup(&dev->dev, devname, 
GFP_KERNEL);
   399                          mmciname = kasprintf(GFP_KERNEL, "lm%x:00700", 
dev->id);
   400                          lookup->dev_id = mmciname;
   401                          /*
   402                           * Offsets on GPIO block 1:
   403                           * 3 = MMC WP (write protect)
   404                           * 4 = MMC CD (card detect)
   405                           *
   406                           * Offsets on GPIO block 2:
   407                           * 0 = Up key
   408                           * 1 = Down key
   409                           * 2 = Left key
   410                           * 3 = Right key
   411                           * 4 = Key lower left
   412                           * 5 = Key lower right
   413                           */
   414                          /* We need the two MMCI GPIO entries */
   415                          lookup->table[0].chip_label = chipname;
   416                          lookup->table[0].chip_hwnum = 3;
   417                          lookup->table[0].con_id = "wp";
   418                          lookup->table[1].chip_label = chipname;
   419                          lookup->table[1].chip_hwnum = 4;
   420                          lookup->table[1].con_id = "cd";
   421                          lookup->table[1].flags = GPIO_ACTIVE_LOW;
   422                          gpiod_add_lookup_table(lookup);
   423                  }
   424  
   425                  d = amba_ahb_device_add_res(&dev->dev, devname, 
pc_base, SZ_4K,
   426                                              irq1, irq2,
   427                                              idev->platform_data, 
idev->id,
   428                                              &dev->resource);
   429                  if (IS_ERR(d)) {
   430                          dev_err(&dev->dev, "unable to register device: 
%ld\n", PTR_ERR(d));
   431                          continue;
   432                  }
   433          }
   434  
   435          return 0;
   436  }
   437  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to