[pci:pci/host-xilinx 1/7] drivers/pci/endpoint/pci-ep-cfs.c:219:9: warning: control reaches end of non-void function

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/host-xilinx
head:   95b008920fd38e828a37c8a7131b449d33ba03b9
commit: 13ff772beae556a664c029d5d75eaf7f3c104258 [1/7] PCI: Move enum pci_interrupt_pin to linux/pci.h
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 13ff772beae556a664c029d5d75eaf7f3c104258
        # save the attached .config to linux build tree
        make.cross ARCH=m68k 

All warnings (new ones prefixed by >>):

   In file included from include/linux/pci-epc.h:15:0,
                    from drivers/pci/endpoint/pci-ep-cfs.c:23:
   include/linux/pci-epf.h:53:25: error: field 'interrupt_pin' has incomplete type
     enum pci_interrupt_pin interrupt_pin;
                            ^
   drivers/pci/endpoint/pci-ep-cfs.c: In function 'pci_epf_interrupt_pin_show':
>> drivers/pci/endpoint/pci-ep-cfs.c:219:9: warning: control reaches end of non-void function [-Wreturn-type]
     struct pci_epf *epf = to_pci_epf_group(item)->epf;         \
            ^
   drivers/pci/endpoint/pci-ep-cfs.c:322:1: note: in expansion of macro 'PCI_EPF_HEADER_R'
    PCI_EPF_HEADER_R(interrupt_pin)
    ^

vim +219 drivers/pci/endpoint/pci-ep-cfs.c

d7467991 Kishon Vijay Abraham I 2017-03-27   22  
d7467991 Kishon Vijay Abraham I 2017-03-27  @23  #include <linux/pci-epc.h>
d7467991 Kishon Vijay Abraham I 2017-03-27   24  #include <linux/pci-epf.h>
d7467991 Kishon Vijay Abraham I 2017-03-27   25  #include <linux/pci-ep-cfs.h>
d7467991 Kishon Vijay Abraham I 2017-03-27   26  
d7467991 Kishon Vijay Abraham I 2017-03-27   27  static struct config_group *functions_group;
d7467991 Kishon Vijay Abraham I 2017-03-27   28  static struct config_group *controllers_group;
d7467991 Kishon Vijay Abraham I 2017-03-27   29  
d7467991 Kishon Vijay Abraham I 2017-03-27   30  struct pci_epf_group {
d7467991 Kishon Vijay Abraham I 2017-03-27   31  	struct config_group group;
d7467991 Kishon Vijay Abraham I 2017-03-27   32  	struct pci_epf *epf;
d7467991 Kishon Vijay Abraham I 2017-03-27   33  };
d7467991 Kishon Vijay Abraham I 2017-03-27   34  
d7467991 Kishon Vijay Abraham I 2017-03-27   35  struct pci_epc_group {
d7467991 Kishon Vijay Abraham I 2017-03-27   36  	struct config_group group;
d7467991 Kishon Vijay Abraham I 2017-03-27   37  	struct pci_epc *epc;
d7467991 Kishon Vijay Abraham I 2017-03-27   38  	bool start;
d7467991 Kishon Vijay Abraham I 2017-03-27   39  	unsigned long function_num_map;
d7467991 Kishon Vijay Abraham I 2017-03-27   40  };
d7467991 Kishon Vijay Abraham I 2017-03-27   41  
d7467991 Kishon Vijay Abraham I 2017-03-27   42  static inline struct pci_epf_group *to_pci_epf_group(struct config_item *item)
d7467991 Kishon Vijay Abraham I 2017-03-27   43  {
d7467991 Kishon Vijay Abraham I 2017-03-27   44  	return container_of(to_config_group(item), struct pci_epf_group, group);
d7467991 Kishon Vijay Abraham I 2017-03-27   45  }
d7467991 Kishon Vijay Abraham I 2017-03-27   46  
d7467991 Kishon Vijay Abraham I 2017-03-27   47  static inline struct pci_epc_group *to_pci_epc_group(struct config_item *item)
d7467991 Kishon Vijay Abraham I 2017-03-27   48  {
d7467991 Kishon Vijay Abraham I 2017-03-27   49  	return container_of(to_config_group(item), struct pci_epc_group, group);
d7467991 Kishon Vijay Abraham I 2017-03-27   50  }
d7467991 Kishon Vijay Abraham I 2017-03-27   51  
d7467991 Kishon Vijay Abraham I 2017-03-27   52  static ssize_t pci_epc_start_store(struct config_item *item, const char *page,
d7467991 Kishon Vijay Abraham I 2017-03-27   53  				   size_t len)
d7467991 Kishon Vijay Abraham I 2017-03-27   54  {
d7467991 Kishon Vijay Abraham I 2017-03-27   55  	int ret;
d7467991 Kishon Vijay Abraham I 2017-03-27   56  	bool start;
d7467991 Kishon Vijay Abraham I 2017-03-27   57  	struct pci_epc *epc;
d7467991 Kishon Vijay Abraham I 2017-03-27   58  	struct pci_epc_group *epc_group = to_pci_epc_group(item);
d7467991 Kishon Vijay Abraham I 2017-03-27   59  
d7467991 Kishon Vijay Abraham I 2017-03-27   60  	epc = epc_group->epc;
d7467991 Kishon Vijay Abraham I 2017-03-27   61  
d7467991 Kishon Vijay Abraham I 2017-03-27   62  	ret = kstrtobool(page, &start);
d7467991 Kishon Vijay Abraham I 2017-03-27   63  	if (ret)
d7467991 Kishon Vijay Abraham I 2017-03-27   64  		return ret;
d7467991 Kishon Vijay Abraham I 2017-03-27   65  
d7467991 Kishon Vijay Abraham I 2017-03-27   66  	if (!start) {
d7467991 Kishon Vijay Abraham I 2017-03-27   67  		pci_epc_stop(epc);
d7467991 Kishon Vijay Abraham I 2017-03-27   68  		return len;
d7467991 Kishon Vijay Abraham I 2017-03-27   69  	}
d7467991 Kishon Vijay Abraham I 2017-03-27   70  
d7467991 Kishon Vijay Abraham I 2017-03-27   71  	ret = pci_epc_start(epc);
d7467991 Kishon Vijay Abraham I 2017-03-27   72  	if (ret) {
d7467991 Kishon Vijay Abraham I 2017-03-27   73  		dev_err(&epc->dev, "failed to start endpoint controller\n");
d7467991 Kishon Vijay Abraham I 2017-03-27   74  		return -EINVAL;
d7467991 Kishon Vijay Abraham I 2017-03-27   75  	}
d7467991 Kishon Vijay Abraham I 2017-03-27   76  
d7467991 Kishon Vijay Abraham I 2017-03-27   77  	epc_group->start = start;
d7467991 Kishon Vijay Abraham I 2017-03-27   78  
d7467991 Kishon Vijay Abraham I 2017-03-27   79  	return len;
d7467991 Kishon Vijay Abraham I 2017-03-27   80  }
d7467991 Kishon Vijay Abraham I 2017-03-27   81  
d7467991 Kishon Vijay Abraham I 2017-03-27   82  static ssize_t pci_epc_start_show(struct config_item *item, char *page)
d7467991 Kishon Vijay Abraham I 2017-03-27   83  {
d7467991 Kishon Vijay Abraham I 2017-03-27   84  	return sprintf(page, "%d\n",
d7467991 Kishon Vijay Abraham I 2017-03-27   85  		       to_pci_epc_group(item)->start);
d7467991 Kishon Vijay Abraham I 2017-03-27   86  }
d7467991 Kishon Vijay Abraham I 2017-03-27   87  
d7467991 Kishon Vijay Abraham I 2017-03-27   88  CONFIGFS_ATTR(pci_epc_, start);
d7467991 Kishon Vijay Abraham I 2017-03-27   89  
d7467991 Kishon Vijay Abraham I 2017-03-27   90  static struct configfs_attribute *pci_epc_attrs[] = {
d7467991 Kishon Vijay Abraham I 2017-03-27   91  	&pci_epc_attr_start,
d7467991 Kishon Vijay Abraham I 2017-03-27   92  	NULL,
d7467991 Kishon Vijay Abraham I 2017-03-27   93  };
d7467991 Kishon Vijay Abraham I 2017-03-27   94  
d7467991 Kishon Vijay Abraham I 2017-03-27   95  static int pci_epc_epf_link(struct config_item *epc_item,
d7467991 Kishon Vijay Abraham I 2017-03-27   96  			    struct config_item *epf_item)
d7467991 Kishon Vijay Abraham I 2017-03-27   97  {
d7467991 Kishon Vijay Abraham I 2017-03-27   98  	int ret;
d7467991 Kishon Vijay Abraham I 2017-03-27   99  	u32 func_no = 0;
d7467991 Kishon Vijay Abraham I 2017-03-27  100  	struct pci_epc *epc;
d7467991 Kishon Vijay Abraham I 2017-03-27  101  	struct pci_epf *epf;
d7467991 Kishon Vijay Abraham I 2017-03-27  102  	struct pci_epf_group *epf_group = to_pci_epf_group(epf_item);
d7467991 Kishon Vijay Abraham I 2017-03-27  103  	struct pci_epc_group *epc_group = to_pci_epc_group(epc_item);
d7467991 Kishon Vijay Abraham I 2017-03-27  104  
d7467991 Kishon Vijay Abraham I 2017-03-27  105  	epc = epc_group->epc;
d7467991 Kishon Vijay Abraham I 2017-03-27  106  	epf = epf_group->epf;
d7467991 Kishon Vijay Abraham I 2017-03-27  107  	ret = pci_epc_add_epf(epc, epf);
d7467991 Kishon Vijay Abraham I 2017-03-27  108  	if (ret)
d7467991 Kishon Vijay Abraham I 2017-03-27  109  		goto err_add_epf;
d7467991 Kishon Vijay Abraham I 2017-03-27  110  
d7467991 Kishon Vijay Abraham I 2017-03-27  111  	func_no = find_first_zero_bit(&epc_group->function_num_map,
d7467991 Kishon Vijay Abraham I 2017-03-27  112  				      sizeof(epc_group->function_num_map));
d7467991 Kishon Vijay Abraham I 2017-03-27  113  	set_bit(func_no, &epc_group->function_num_map);
d7467991 Kishon Vijay Abraham I 2017-03-27  114  	epf->func_no = func_no;
d7467991 Kishon Vijay Abraham I 2017-03-27  115  
d7467991 Kishon Vijay Abraham I 2017-03-27  116  	ret = pci_epf_bind(epf);
d7467991 Kishon Vijay Abraham I 2017-03-27  117  	if (ret)
d7467991 Kishon Vijay Abraham I 2017-03-27  118  		goto err_epf_bind;
d7467991 Kishon Vijay Abraham I 2017-03-27  119  
d7467991 Kishon Vijay Abraham I 2017-03-27  120  	return 0;
d7467991 Kishon Vijay Abraham I 2017-03-27  121  
d7467991 Kishon Vijay Abraham I 2017-03-27  122  err_epf_bind:
d7467991 Kishon Vijay Abraham I 2017-03-27  123  	pci_epc_remove_epf(epc, epf);
d7467991 Kishon Vijay Abraham I 2017-03-27  124  
d7467991 Kishon Vijay Abraham I 2017-03-27  125  err_add_epf:
d7467991 Kishon Vijay Abraham I 2017-03-27  126  	clear_bit(func_no, &epc_group->function_num_map);
d7467991 Kishon Vijay Abraham I 2017-03-27  127  
d7467991 Kishon Vijay Abraham I 2017-03-27  128  	return ret;
d7467991 Kishon Vijay Abraham I 2017-03-27  129  }
d7467991 Kishon Vijay Abraham I 2017-03-27  130  
d7467991 Kishon Vijay Abraham I 2017-03-27  131  static void pci_epc_epf_unlink(struct config_item *epc_item,
d7467991 Kishon Vijay Abraham I 2017-03-27  132  			       struct config_item *epf_item)
d7467991 Kishon Vijay Abraham I 2017-03-27  133  {
d7467991 Kishon Vijay Abraham I 2017-03-27  134  	struct pci_epc *epc;
d7467991 Kishon Vijay Abraham I 2017-03-27  135  	struct pci_epf *epf;
d7467991 Kishon Vijay Abraham I 2017-03-27  136  	struct pci_epf_group *epf_group = to_pci_epf_group(epf_item);
d7467991 Kishon Vijay Abraham I 2017-03-27  137  	struct pci_epc_group *epc_group = to_pci_epc_group(epc_item);
d7467991 Kishon Vijay Abraham I 2017-03-27  138  
d7467991 Kishon Vijay Abraham I 2017-03-27  139  	WARN_ON_ONCE(epc_group->start);
d7467991 Kishon Vijay Abraham I 2017-03-27  140  
d7467991 Kishon Vijay Abraham I 2017-03-27  141  	epc = epc_group->epc;
d7467991 Kishon Vijay Abraham I 2017-03-27  142  	epf = epf_group->epf;
d7467991 Kishon Vijay Abraham I 2017-03-27  143  	clear_bit(epf->func_no, &epc_group->function_num_map);
d7467991 Kishon Vijay Abraham I 2017-03-27  144  	pci_epf_unbind(epf);
d7467991 Kishon Vijay Abraham I 2017-03-27  145  	pci_epc_remove_epf(epc, epf);
d7467991 Kishon Vijay Abraham I 2017-03-27  146  }
d7467991 Kishon Vijay Abraham I 2017-03-27  147  
d7467991 Kishon Vijay Abraham I 2017-03-27  148  static struct configfs_item_operations pci_epc_item_ops = {
d7467991 Kishon Vijay Abraham I 2017-03-27  149  	.allow_link	= pci_epc_epf_link,
d7467991 Kishon Vijay Abraham I 2017-03-27  150  	.drop_link	= pci_epc_epf_unlink,
d7467991 Kishon Vijay Abraham I 2017-03-27  151  };
d7467991 Kishon Vijay Abraham I 2017-03-27  152  
d7467991 Kishon Vijay Abraham I 2017-03-27  153  static struct config_item_type pci_epc_type = {
d7467991 Kishon Vijay Abraham I 2017-03-27  154  	.ct_item_ops	= &pci_epc_item_ops,
d7467991 Kishon Vijay Abraham I 2017-03-27  155  	.ct_attrs	= pci_epc_attrs,
d7467991 Kishon Vijay Abraham I 2017-03-27  156  	.ct_owner	= THIS_MODULE,
d7467991 Kishon Vijay Abraham I 2017-03-27  157  };
d7467991 Kishon Vijay Abraham I 2017-03-27  158  
d7467991 Kishon Vijay Abraham I 2017-03-27  159  struct config_group *pci_ep_cfs_add_epc_group(const char *name)
d7467991 Kishon Vijay Abraham I 2017-03-27  160  {
d7467991 Kishon Vijay Abraham I 2017-03-27  161  	int ret;
d7467991 Kishon Vijay Abraham I 2017-03-27  162  	struct pci_epc *epc;
d7467991 Kishon Vijay Abraham I 2017-03-27  163  	struct config_group *group;
d7467991 Kishon Vijay Abraham I 2017-03-27  164  	struct pci_epc_group *epc_group;
d7467991 Kishon Vijay Abraham I 2017-03-27  165  
d7467991 Kishon Vijay Abraham I 2017-03-27  166  	epc_group = kzalloc(sizeof(*epc_group), GFP_KERNEL);
d7467991 Kishon Vijay Abraham I 2017-03-27  167  	if (!epc_group) {
d7467991 Kishon Vijay Abraham I 2017-03-27  168  		ret = -ENOMEM;
d7467991 Kishon Vijay Abraham I 2017-03-27  169  		goto err;
d7467991 Kishon Vijay Abraham I 2017-03-27  170  	}
d7467991 Kishon Vijay Abraham I 2017-03-27  171  
d7467991 Kishon Vijay Abraham I 2017-03-27  172  	group = &epc_group->group;
d7467991 Kishon Vijay Abraham I 2017-03-27  173  
d7467991 Kishon Vijay Abraham I 2017-03-27  174  	config_group_init_type_name(group, name, &pci_epc_type);
d7467991 Kishon Vijay Abraham I 2017-03-27  175  	ret = configfs_register_group(controllers_group, group);
d7467991 Kishon Vijay Abraham I 2017-03-27  176  	if (ret) {
d7467991 Kishon Vijay Abraham I 2017-03-27  177  		pr_err("failed to register configfs group for %s\n", name);
d7467991 Kishon Vijay Abraham I 2017-03-27  178  		goto err_register_group;
d7467991 Kishon Vijay Abraham I 2017-03-27  179  	}
d7467991 Kishon Vijay Abraham I 2017-03-27  180  
d7467991 Kishon Vijay Abraham I 2017-03-27  181  	epc = pci_epc_get(name);
d7467991 Kishon Vijay Abraham I 2017-03-27  182  	if (IS_ERR(epc)) {
d7467991 Kishon Vijay Abraham I 2017-03-27  183  		ret = PTR_ERR(epc);
d7467991 Kishon Vijay Abraham I 2017-03-27  184  		goto err_epc_get;
d7467991 Kishon Vijay Abraham I 2017-03-27  185  	}
d7467991 Kishon Vijay Abraham I 2017-03-27  186  
d7467991 Kishon Vijay Abraham I 2017-03-27  187  	epc_group->epc = epc;
d7467991 Kishon Vijay Abraham I 2017-03-27  188  
d7467991 Kishon Vijay Abraham I 2017-03-27  189  	return group;
d7467991 Kishon Vijay Abraham I 2017-03-27  190  
d7467991 Kishon Vijay Abraham I 2017-03-27  191  err_epc_get:
d7467991 Kishon Vijay Abraham I 2017-03-27  192  	configfs_unregister_group(group);
d7467991 Kishon Vijay Abraham I 2017-03-27  193  
d7467991 Kishon Vijay Abraham I 2017-03-27  194  err_register_group:
d7467991 Kishon Vijay Abraham I 2017-03-27  195  	kfree(epc_group);
d7467991 Kishon Vijay Abraham I 2017-03-27  196  
d7467991 Kishon Vijay Abraham I 2017-03-27  197  err:
d7467991 Kishon Vijay Abraham I 2017-03-27  198  	return ERR_PTR(ret);
d7467991 Kishon Vijay Abraham I 2017-03-27  199  }
d7467991 Kishon Vijay Abraham I 2017-03-27  200  EXPORT_SYMBOL(pci_ep_cfs_add_epc_group);
d7467991 Kishon Vijay Abraham I 2017-03-27  201  
d7467991 Kishon Vijay Abraham I 2017-03-27  202  void pci_ep_cfs_remove_epc_group(struct config_group *group)
d7467991 Kishon Vijay Abraham I 2017-03-27  203  {
d7467991 Kishon Vijay Abraham I 2017-03-27  204  	struct pci_epc_group *epc_group;
d7467991 Kishon Vijay Abraham I 2017-03-27  205  
d7467991 Kishon Vijay Abraham I 2017-03-27  206  	if (!group)
d7467991 Kishon Vijay Abraham I 2017-03-27  207  		return;
d7467991 Kishon Vijay Abraham I 2017-03-27  208  
d7467991 Kishon Vijay Abraham I 2017-03-27  209  	epc_group = container_of(group, struct pci_epc_group, group);
d7467991 Kishon Vijay Abraham I 2017-03-27  210  	pci_epc_put(epc_group->epc);
d7467991 Kishon Vijay Abraham I 2017-03-27  211  	configfs_unregister_group(&epc_group->group);
d7467991 Kishon Vijay Abraham I 2017-03-27  212  	kfree(epc_group);
d7467991 Kishon Vijay Abraham I 2017-03-27  213  }
d7467991 Kishon Vijay Abraham I 2017-03-27  214  EXPORT_SYMBOL(pci_ep_cfs_remove_epc_group);
d7467991 Kishon Vijay Abraham I 2017-03-27  215  
d7467991 Kishon Vijay Abraham I 2017-03-27  216  #define PCI_EPF_HEADER_R(_name)						       \
d7467991 Kishon Vijay Abraham I 2017-03-27  217  static ssize_t pci_epf_##_name##_show(struct config_item *item,	char *page)    \
d7467991 Kishon Vijay Abraham I 2017-03-27  218  {									       \
d7467991 Kishon Vijay Abraham I 2017-03-27 @219  	struct pci_epf *epf = to_pci_epf_group(item)->epf;		       \
d7467991 Kishon Vijay Abraham I 2017-03-27  220  	if (WARN_ON_ONCE(!epf->header))					       \
d7467991 Kishon Vijay Abraham I 2017-03-27  221  		return -EINVAL;						       \
d7467991 Kishon Vijay Abraham I 2017-03-27  222  	return sprintf(page, "0x%04x\n", epf->header->_name);		       \
d7467991 Kishon Vijay Abraham I 2017-03-27  223  }
d7467991 Kishon Vijay Abraham I 2017-03-27  224  

:::::: The code at line 219 was first introduced by commit
:::::: d746799116103d857be203382b09035bbe225d03 PCI: endpoint: Introduce configfs entry for configuring EP functions

:::::: TO: Kishon Vijay Abraham I <kishon@xxxxxx>
:::::: CC: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux