From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [asahilinux:bits/090-spi-hid 15/21] drivers/hid/dockchannel-hid/dockchannel-hid.c:1173 dockchannel_hid_probe() warn: passing zero to 'PTR_ERR'
Date: Mon, 27 Nov 2023 17:43:48 +0800 [thread overview]
Message-ID: <202311271546.ImsRFnlZ-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Hector Martin <marcan@marcan.st>
tree: https://github.com/AsahiLinux/linux bits/090-spi-hid
head: 16871bb3228eaf55cbdb1dfb81c1cecec4ee0d52
commit: af53f3ff74f442fae36262bda9be6a94ad52925e [15/21] hid: Add Apple DockChannel HID transport driver
:::::: branch date: 8 days ago
:::::: commit date: 10 weeks ago
config: parisc-randconfig-r071-20231127 (https://download.01.org/0day-ci/archive/20231127/202311271546.ImsRFnlZ-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231127/202311271546.ImsRFnlZ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202311271546.ImsRFnlZ-lkp@intel.com/
smatch warnings:
drivers/hid/dockchannel-hid/dockchannel-hid.c:1173 dockchannel_hid_probe() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +1173 drivers/hid/dockchannel-hid/dockchannel-hid.c
af53f3ff74f442 Hector Martin 2022-07-08 1093
af53f3ff74f442 Hector Martin 2022-07-08 1094 static int dockchannel_hid_probe(struct platform_device *pdev)
af53f3ff74f442 Hector Martin 2022-07-08 1095 {
af53f3ff74f442 Hector Martin 2022-07-08 1096 struct device *dev = &pdev->dev;
af53f3ff74f442 Hector Martin 2022-07-08 1097 struct dockchannel_hid *dchid;
af53f3ff74f442 Hector Martin 2022-07-08 1098 struct device_node *child, *helper;
af53f3ff74f442 Hector Martin 2022-07-08 1099 struct platform_device *helper_pdev;
af53f3ff74f442 Hector Martin 2022-07-08 1100 struct property *prop;
af53f3ff74f442 Hector Martin 2022-07-08 1101 int ret;
af53f3ff74f442 Hector Martin 2022-07-08 1102
af53f3ff74f442 Hector Martin 2022-07-08 1103 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
af53f3ff74f442 Hector Martin 2022-07-08 1104 if (ret)
af53f3ff74f442 Hector Martin 2022-07-08 1105 return ret;
af53f3ff74f442 Hector Martin 2022-07-08 1106
af53f3ff74f442 Hector Martin 2022-07-08 1107 dchid = devm_kzalloc(dev, sizeof(*dchid), GFP_KERNEL);
af53f3ff74f442 Hector Martin 2022-07-08 1108 if (!dchid) {
af53f3ff74f442 Hector Martin 2022-07-08 1109 return -ENOMEM;
af53f3ff74f442 Hector Martin 2022-07-08 1110 }
af53f3ff74f442 Hector Martin 2022-07-08 1111
af53f3ff74f442 Hector Martin 2022-07-08 1112 dchid->dev = dev;
af53f3ff74f442 Hector Martin 2022-07-08 1113
af53f3ff74f442 Hector Martin 2022-07-08 1114 /*
af53f3ff74f442 Hector Martin 2022-07-08 1115 * First make sure all the GPIOs are available, in cased we need to defer.
af53f3ff74f442 Hector Martin 2022-07-08 1116 * This is necessary because MTP will request them by name later, and by then
af53f3ff74f442 Hector Martin 2022-07-08 1117 * it's too late to defer the probe.
af53f3ff74f442 Hector Martin 2022-07-08 1118 */
af53f3ff74f442 Hector Martin 2022-07-08 1119
af53f3ff74f442 Hector Martin 2022-07-08 1120 for_each_child_of_node(dev->of_node, child) {
af53f3ff74f442 Hector Martin 2022-07-08 1121 for_each_property_of_node(child, prop) {
af53f3ff74f442 Hector Martin 2022-07-08 1122 size_t len = strlen(prop->name);
af53f3ff74f442 Hector Martin 2022-07-08 1123 struct gpio_desc *gpio;
af53f3ff74f442 Hector Martin 2022-07-08 1124
af53f3ff74f442 Hector Martin 2022-07-08 1125 if (len < 12 || strncmp("apple,", prop->name, 6) ||
af53f3ff74f442 Hector Martin 2022-07-08 1126 strcmp("-gpios", prop->name + len - 6))
af53f3ff74f442 Hector Martin 2022-07-08 1127 continue;
af53f3ff74f442 Hector Martin 2022-07-08 1128
af53f3ff74f442 Hector Martin 2022-07-08 1129 gpio = fwnode_gpiod_get_index(&child->fwnode, prop->name, 0, GPIOD_ASIS,
af53f3ff74f442 Hector Martin 2022-07-08 1130 prop->name);
af53f3ff74f442 Hector Martin 2022-07-08 1131 if (IS_ERR_OR_NULL(gpio)) {
af53f3ff74f442 Hector Martin 2022-07-08 1132 if (PTR_ERR(gpio) == -EPROBE_DEFER) {
af53f3ff74f442 Hector Martin 2022-07-08 1133 of_node_put(child);
af53f3ff74f442 Hector Martin 2022-07-08 1134 return -EPROBE_DEFER;
af53f3ff74f442 Hector Martin 2022-07-08 1135 }
af53f3ff74f442 Hector Martin 2022-07-08 1136 } else {
af53f3ff74f442 Hector Martin 2022-07-08 1137 gpiod_put(gpio);
af53f3ff74f442 Hector Martin 2022-07-08 1138 }
af53f3ff74f442 Hector Martin 2022-07-08 1139 }
af53f3ff74f442 Hector Martin 2022-07-08 1140 }
af53f3ff74f442 Hector Martin 2022-07-08 1141
af53f3ff74f442 Hector Martin 2022-07-08 1142 /*
af53f3ff74f442 Hector Martin 2022-07-08 1143 * Make sure we also have the MTP coprocessor available, and
af53f3ff74f442 Hector Martin 2022-07-08 1144 * defer probe if the helper hasn't probed yet.
af53f3ff74f442 Hector Martin 2022-07-08 1145 */
af53f3ff74f442 Hector Martin 2022-07-08 1146 helper = of_parse_phandle(dev->of_node, "apple,helper-cpu", 0);
af53f3ff74f442 Hector Martin 2022-07-08 1147 if (!helper) {
af53f3ff74f442 Hector Martin 2022-07-08 1148 dev_err(dev, "Missing apple,helper-cpu property");
af53f3ff74f442 Hector Martin 2022-07-08 1149 return -EINVAL;
af53f3ff74f442 Hector Martin 2022-07-08 1150 }
af53f3ff74f442 Hector Martin 2022-07-08 1151
af53f3ff74f442 Hector Martin 2022-07-08 1152 helper_pdev = of_find_device_by_node(helper);
af53f3ff74f442 Hector Martin 2022-07-08 1153 of_node_put(helper);
af53f3ff74f442 Hector Martin 2022-07-08 1154 if (!helper_pdev) {
af53f3ff74f442 Hector Martin 2022-07-08 1155 dev_err(dev, "Failed to find helper device");
af53f3ff74f442 Hector Martin 2022-07-08 1156 return -EINVAL;
af53f3ff74f442 Hector Martin 2022-07-08 1157 }
af53f3ff74f442 Hector Martin 2022-07-08 1158
af53f3ff74f442 Hector Martin 2022-07-08 1159 dchid->helper_link = device_link_add(dev, &helper_pdev->dev,
af53f3ff74f442 Hector Martin 2022-07-08 1160 DL_FLAG_AUTOREMOVE_CONSUMER);
af53f3ff74f442 Hector Martin 2022-07-08 1161 put_device(&helper_pdev->dev);
af53f3ff74f442 Hector Martin 2022-07-08 1162 if (!dchid->helper_link) {
af53f3ff74f442 Hector Martin 2022-07-08 1163 dev_err(dev, "Failed to link to helper device");
af53f3ff74f442 Hector Martin 2022-07-08 1164 return -EINVAL;
af53f3ff74f442 Hector Martin 2022-07-08 1165 }
af53f3ff74f442 Hector Martin 2022-07-08 1166
af53f3ff74f442 Hector Martin 2022-07-08 1167 if (dchid->helper_link->supplier->links.status != DL_DEV_DRIVER_BOUND)
af53f3ff74f442 Hector Martin 2022-07-08 1168 return -EPROBE_DEFER;
af53f3ff74f442 Hector Martin 2022-07-08 1169
af53f3ff74f442 Hector Martin 2022-07-08 1170 /* Now it is safe to begin initializing */
af53f3ff74f442 Hector Martin 2022-07-08 1171 dchid->dc = dockchannel_init(pdev);
af53f3ff74f442 Hector Martin 2022-07-08 1172 if (IS_ERR_OR_NULL(dchid->dc)) {
af53f3ff74f442 Hector Martin 2022-07-08 @1173 return PTR_ERR(dchid->dc);
af53f3ff74f442 Hector Martin 2022-07-08 1174 }
af53f3ff74f442 Hector Martin 2022-07-08 1175 dchid->new_iface_wq = alloc_workqueue("dchid-new", WQ_MEM_RECLAIM, 0);
af53f3ff74f442 Hector Martin 2022-07-08 1176 if (!dchid->new_iface_wq)
af53f3ff74f442 Hector Martin 2022-07-08 1177 return -ENOMEM;
af53f3ff74f442 Hector Martin 2022-07-08 1178
af53f3ff74f442 Hector Martin 2022-07-08 1179 dchid->comm = dchid_get_interface(dchid, IFACE_COMM, "comm");
af53f3ff74f442 Hector Martin 2022-07-08 1180 if (!dchid->comm) {
af53f3ff74f442 Hector Martin 2022-07-08 1181 dev_err(dchid->dev, "Failed to initialize comm interface");
af53f3ff74f442 Hector Martin 2022-07-08 1182 return -EIO;
af53f3ff74f442 Hector Martin 2022-07-08 1183 }
af53f3ff74f442 Hector Martin 2022-07-08 1184
af53f3ff74f442 Hector Martin 2022-07-08 1185 dev_info(dchid->dev, "Initialized, awaiting packets\n");
af53f3ff74f442 Hector Martin 2022-07-08 1186 dockchannel_await(dchid->dc, dchid_handle_packet, dchid, sizeof(struct dchid_hdr));
af53f3ff74f442 Hector Martin 2022-07-08 1187
af53f3ff74f442 Hector Martin 2022-07-08 1188 return 0;
af53f3ff74f442 Hector Martin 2022-07-08 1189 }
af53f3ff74f442 Hector Martin 2022-07-08 1190
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-11-27 9:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 9:43 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-11-27 11:30 [asahilinux:bits/090-spi-hid 15/21] drivers/hid/dockchannel-hid/dockchannel-hid.c:1173 dockchannel_hid_probe() warn: passing zero to 'PTR_ERR' Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202311271546.ImsRFnlZ-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.