Re: [PATCH] libertas: return errno from lbs_add_card()

From: kbuild test robot
Date: Tue Sep 25 2018 - 00:17:28 EST


Hi Lubomir,

I love your patch! Yet something to improve:

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on v4.19-rc5 next-20180924]
[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/Lubomir-Rintel/libertas-return-errno-from-lbs_add_card/20180925-105034
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-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=sh

All errors (new ones prefixed by >>):

drivers/net//wireless/marvell/libertas/if_usb.c: In function 'if_usb_probe':
>> drivers/net//wireless/marvell/libertas/if_usb.c:259:3: error: 'ret' undeclared (first use in this function); did you mean 'net'?
ret = PTR_ERR(priv);
^~~
net
drivers/net//wireless/marvell/libertas/if_usb.c:259:3: note: each undeclared identifier is reported only once for each function it appears in
--
drivers/net//wireless/marvell/libertas/if_spi.c: In function 'if_spi_probe':
>> drivers/net//wireless/marvell/libertas/if_spi.c:1150:3: error: 'ret' undeclared (first use in this function); did you mean 'net'?
ret = PTR_ERR(priv);
^~~
net
drivers/net//wireless/marvell/libertas/if_spi.c:1150:3: note: each undeclared identifier is reported only once for each function it appears in

vim +259 drivers/net//wireless/marvell/libertas/if_usb.c

184
185 /**
186 * if_usb_probe - sets the configuration values
187 * @intf: &usb_interface pointer
188 * @id: pointer to usb_device_id
189 * returns: 0 on success, error code on failure
190 */
191 static int if_usb_probe(struct usb_interface *intf,
192 const struct usb_device_id *id)
193 {
194 struct usb_device *udev;
195 struct usb_host_interface *iface_desc;
196 struct usb_endpoint_descriptor *endpoint;
197 struct lbs_private *priv;
198 struct if_usb_card *cardp;
199 int r = -ENOMEM;
200 int i;
201
202 udev = interface_to_usbdev(intf);
203
204 cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL);
205 if (!cardp)
206 goto error;
207
208 timer_setup(&cardp->fw_timeout, if_usb_fw_timeo, 0);
209 init_waitqueue_head(&cardp->fw_wq);
210
211 cardp->udev = udev;
212 cardp->model = (uint32_t) id->driver_info;
213 iface_desc = intf->cur_altsetting;
214
215 lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
216 " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n",
217 le16_to_cpu(udev->descriptor.bcdUSB),
218 udev->descriptor.bDeviceClass,
219 udev->descriptor.bDeviceSubClass,
220 udev->descriptor.bDeviceProtocol);
221
222 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
223 endpoint = &iface_desc->endpoint[i].desc;
224 if (usb_endpoint_is_bulk_in(endpoint)) {
225 cardp->ep_in_size = le16_to_cpu(endpoint->wMaxPacketSize);
226 cardp->ep_in = usb_endpoint_num(endpoint);
227
228 lbs_deb_usbd(&udev->dev, "in_endpoint = %d\n", cardp->ep_in);
229 lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n", cardp->ep_in_size);
230
231 } else if (usb_endpoint_is_bulk_out(endpoint)) {
232 cardp->ep_out_size = le16_to_cpu(endpoint->wMaxPacketSize);
233 cardp->ep_out = usb_endpoint_num(endpoint);
234
235 lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n", cardp->ep_out);
236 lbs_deb_usbd(&udev->dev, "Bulk out size is %d\n", cardp->ep_out_size);
237 }
238 }
239 if (!cardp->ep_out_size || !cardp->ep_in_size) {
240 lbs_deb_usbd(&udev->dev, "Endpoints not found\n");
241 goto dealloc;
242 }
243 if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
244 lbs_deb_usbd(&udev->dev, "Rx URB allocation failed\n");
245 goto dealloc;
246 }
247 if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
248 lbs_deb_usbd(&udev->dev, "Tx URB allocation failed\n");
249 goto dealloc;
250 }
251 cardp->ep_out_buf = kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, GFP_KERNEL);
252 if (!cardp->ep_out_buf) {
253 lbs_deb_usbd(&udev->dev, "Could not allocate buffer\n");
254 goto dealloc;
255 }
256
257 priv = lbs_add_card(cardp, &intf->dev);
258 if (IS_ERR(priv)) {
> 259 ret = PTR_ERR(priv);
260 goto err_add_card;
261 }
262
263 cardp->priv = priv;
264
265 priv->hw_host_to_card = if_usb_host_to_card;
266 priv->enter_deep_sleep = NULL;
267 priv->exit_deep_sleep = NULL;
268 priv->reset_deep_sleep_wakeup = NULL;
269 priv->is_polling = false;
270 #ifdef CONFIG_OLPC
271 if (machine_is_olpc())
272 priv->reset_card = if_usb_reset_olpc_card;
273 #endif
274
275 cardp->boot2_version = udev->descriptor.bcdDevice;
276
277 usb_get_dev(udev);
278 usb_set_intfdata(intf, cardp);
279
280 r = lbs_get_firmware_async(priv, &udev->dev, cardp->model,
281 fw_table, if_usb_prog_firmware);
282 if (r)
283 goto err_get_fw;
284
285 return 0;
286
287 err_get_fw:
288 lbs_remove_card(priv);
289 err_add_card:
290 if_usb_reset_device(cardp);
291 dealloc:
292 if_usb_free(cardp);
293
294 error:
295 return r;
296 }
297

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

Attachment: .config.gz
Description: application/gzip