Re: [PATCH 3/6] usb: dwc3: haps: Constify the software node

From: kernel test robot
Date: Tue Feb 02 2021 - 14:31:02 EST


Hi Heikki,

I love your patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on next-20210125]
[cannot apply to balbi-usb/testing/next char-misc/char-misc-testing v5.11-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Heikki-Krogerus/usb-Handle-device-properties-with-software-node-API/20210202-205900
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-c002-20210202 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/399031fcde9483395785bd0eec474c584bd1e9fd
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Heikki-Krogerus/usb-Handle-device-properties-with-software-node-API/20210202-205900
git checkout 399031fcde9483395785bd0eec474c584bd1e9fd
# save the attached .config to linux build tree
make W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/usb/dwc3/dwc3-haps.c: In function 'dwc3_haps_probe':
>> drivers/usb/dwc3/dwc3-haps.c:84:50: error: incompatible type for argument 2 of 'device_add_software_node'
84 | ret = device_add_software_node(&dwc->dwc3->dev, dwc3_haps_swnode);
| ^~~~~~~~~~~~~~~~
| |
| const struct software_node
In file included from drivers/usb/dwc3/dwc3-haps.c:16:
include/linux/property.h:491:78: note: expected 'const struct software_node *' but argument is of type 'const struct software_node'
491 | int device_add_software_node(struct device *dev, const struct software_node *swnode);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~


vim +/device_add_software_node +84 drivers/usb/dwc3/dwc3-haps.c

39
40 static int dwc3_haps_probe(struct pci_dev *pci,
41 const struct pci_device_id *id)
42 {
43 struct dwc3_haps *dwc;
44 struct device *dev = &pci->dev;
45 struct resource res[2];
46 int ret;
47
48 ret = pcim_enable_device(pci);
49 if (ret) {
50 dev_err(dev, "failed to enable pci device\n");
51 return -ENODEV;
52 }
53
54 pci_set_master(pci);
55
56 dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL);
57 if (!dwc)
58 return -ENOMEM;
59
60 dwc->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO);
61 if (!dwc->dwc3)
62 return -ENOMEM;
63
64 memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res));
65
66 res[0].start = pci_resource_start(pci, 0);
67 res[0].end = pci_resource_end(pci, 0);
68 res[0].name = "dwc_usb3";
69 res[0].flags = IORESOURCE_MEM;
70
71 res[1].start = pci->irq;
72 res[1].name = "dwc_usb3";
73 res[1].flags = IORESOURCE_IRQ;
74
75 ret = platform_device_add_resources(dwc->dwc3, res, ARRAY_SIZE(res));
76 if (ret) {
77 dev_err(dev, "couldn't add resources to dwc3 device\n");
78 goto err;
79 }
80
81 dwc->pci = pci;
82 dwc->dwc3->dev.parent = dev;
83
> 84 ret = device_add_software_node(&dwc->dwc3->dev, dwc3_haps_swnode);
85 if (ret)
86 goto err;
87
88 ret = platform_device_add(dwc->dwc3);
89 if (ret) {
90 dev_err(dev, "failed to register dwc3 device\n");
91 goto err;
92 }
93
94 pci_set_drvdata(pci, dwc);
95
96 return 0;
97 err:
98 device_remove_software_node(&dwc->dwc3->dev);
99 platform_device_put(dwc->dwc3);
100 return ret;
101 }
102

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip