Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.4-rc7 next-20191115]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    
https://github.com/0day-ci/linux/commits/patrick-rudolph-9elements-com/firmware-google-Expose-coreboot-tables-and-CBMEM/20191116-033417
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
96b95eff4a591dbac582c2590d067e356a18aacb
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-32-g233d4e1-dirty
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>


sparse warnings: (new ones prefixed by >>)

>> drivers/firmware/google/cbmem-coreboot.c:79:44: sparse: sparse: incorrect 
>> type in argument 4 (different address spaces) @@    expected void const 
>> *from @@    got void [noderef] <asvoid const *from @@
>> drivers/firmware/google/cbmem-coreboot.c:79:44: sparse:    expected void 
>> const *from
>> drivers/firmware/google/cbmem-coreboot.c:79:44: sparse:    got void 
>> [noderef] <asn:2> *const remap
>> drivers/firmware/google/cbmem-coreboot.c:110:21: sparse: sparse: incorrect 
>> type in assignment (different address spaces) @@    expected void [noderef] 
>> <asn:2> *remap @@    got n:2> *remap @@
>> drivers/firmware/google/cbmem-coreboot.c:110:21: sparse:    expected void 
>> [noderef] <asn:2> *remap
>> drivers/firmware/google/cbmem-coreboot.c:110:21: sparse:    got void *
>> drivers/firmware/google/cbmem-coreboot.c:120:30: sparse: sparse: incorrect 
>> type in argument 1 (different address spaces) @@    expected void *addr @@   
>>  got void [noderef] <asvoid *addr @@
>> drivers/firmware/google/cbmem-coreboot.c:120:30: sparse:    expected void 
>> *addr
>> drivers/firmware/google/cbmem-coreboot.c:120:30: sparse:    got void 
>> [noderef] <asn:2> *remap
>> drivers/firmware/google/cbmem-coreboot.c:142:30: sparse: sparse: incorrect 
>> type in argument 1 (different address spaces) @@    expected void *addr @@   
>>  got void [noderef] <asn:2> *void *addr @@
   drivers/firmware/google/cbmem-coreboot.c:142:30: sparse:    expected void 
*addr
   drivers/firmware/google/cbmem-coreboot.c:142:30: sparse:    got void 
[noderef] <asn:2> *const remap

vim +79 drivers/firmware/google/cbmem-coreboot.c

    68  
    69  static ssize_t cbmem_data_read(struct file *filp, struct kobject *kobj,
    70                                 struct bin_attribute *bin_attr,
    71                                 char *buffer, loff_t offset, size_t 
count)
    72  {
    73          struct device *dev = kobj_to_dev(kobj);
    74          const struct cb_priv *priv;
    75  
    76          priv = (const struct cb_priv *)dev_get_platdata(dev);
    77  
    78          return memory_read_from_buffer(buffer, count, &offset,
  > 79                                         priv->remap, priv->entry.size);
    80  }
    81  
    82  static struct bin_attribute coreboot_attr_data = {
    83          .attr = { .name = "data", .mode = 0444 },
    84          .read = cbmem_data_read,
    85  };
    86  
    87  static struct bin_attribute *cb_mem_bin_attrs[] = {
    88          &coreboot_attr_data,
    89          NULL
    90  };
    91  
    92  static struct attribute_group cb_mem_attr_group = {
    93          .name = "cbmem_attributes",
    94          .attrs = cb_mem_attrs,
    95          .bin_attrs = cb_mem_bin_attrs,
    96  };
    97  
    98  static int cbmem_probe(struct coreboot_device *cdev)
    99  {
   100          struct device *dev = &cdev->dev;
   101          struct cb_priv *priv;
   102          int err;
   103  
   104          priv = kzalloc(sizeof(*priv), GFP_KERNEL);
   105          if (!priv)
   106                  return -ENOMEM;
   107  
   108          memcpy(&priv->entry, &cdev->cbmem_entry, sizeof(priv->entry));
   109  
 > 110          priv->remap = memremap(priv->entry.address,
   111                                 priv->entry.entry_size, MEMREMAP_WB);
   112          if (!priv->remap) {
   113                  err = -ENOMEM;
   114                  goto failure;
   115          }
   116  
   117          err = sysfs_create_group(&dev->kobj, &cb_mem_attr_group);
   118          if (err) {
   119                  dev_err(dev, "failed to create sysfs attributes: %d\n", 
err);
 > 120                  memunmap(priv->remap);
   121                  goto failure;
   122          }
   123  
   124          dev->platform_data = priv;
   125  
   126          return 0;
   127  failure:
   128          kfree(priv);
   129          return err;
   130  }
   131  
   132  static int cbmem_remove(struct coreboot_device *cdev)
   133  {
   134          struct device *dev = &cdev->dev;
   135          const struct cb_priv *priv;
   136  
   137          priv = (const struct cb_priv *)dev_get_platdata(dev);
   138  
   139          sysfs_remove_group(&dev->kobj, &cb_mem_attr_group);
   140  
   141          if (priv)
 > 142                  memunmap(priv->remap);
   143          kfree(priv);
   144  
   145          dev->platform_data = NULL;
   146  
   147          return 0;
   148  }
   149  

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation
_______________________________________________
coreboot mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to