summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2021-04-07 19:05:30 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-08 09:26:32 +0200
commit7a267097504f68ca4cd64fb1a80902a113230e1e (patch)
tree8543272a0e323a21d15e18e83f01c37570232e9e /drivers
parent57ae96149e8967ab1043dc1351966ac61b620978 (diff)
staging: rtl8188eu: make usb_dvobj_init return a status
usb_dvobj_init populates a struct dvobj_priv and installs it as interface data of the usb interface. There's no point in returning this struct to the caller, it makes more sense to return an error status. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20210407170531.29356-9-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/rtl8188eu/os_dep/usb_intf.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index 301dab65b571..71ef7941f688 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -48,7 +48,7 @@ static const struct usb_device_id rtw_usb_id_tbl[] = {
MODULE_DEVICE_TABLE(usb, rtw_usb_id_tbl);
-static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
+static int usb_dvobj_init(struct usb_interface *usb_intf)
{
int i;
struct dvobj_priv *pdvobjpriv;
@@ -61,7 +61,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
pdvobjpriv = kzalloc(sizeof(*pdvobjpriv), GFP_KERNEL);
if (!pdvobjpriv)
- return NULL;
+ return -ENOMEM;
pdvobjpriv->pusbintf = usb_intf;
pusbd = interface_to_usbdev(usb_intf);
@@ -108,7 +108,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
mutex_init(&pdvobjpriv->usb_vendor_req_mutex);
usb_get_dev(pusbd);
- return pdvobjpriv;
+ return 0;
}
static void usb_dvobj_deinit(struct usb_interface *usb_intf)
@@ -450,27 +450,21 @@ static void rtw_usb_if1_deinit(struct adapter *if1)
static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid)
{
- struct dvobj_priv *dvobj;
+ int err;
- /* Initialize dvobj_priv */
- dvobj = usb_dvobj_init(pusb_intf);
- if (!dvobj) {
- RT_TRACE(_module_hci_intfs_c_, _drv_err_,
- ("initialize device object priv Failed!\n"));
- goto exit;
+ err = usb_dvobj_init(pusb_intf);
+ if (err) {
+ pr_debug("usb_dvobj_init failed\n");
+ return err;
}
if (!rtw_usb_if1_init(pusb_intf)) {
pr_debug("rtw_usb_if1_init failed\n");
- goto free_dvobj;
+ usb_dvobj_deinit(pusb_intf);
+ return -ENODEV;
}
return 0;
-
-free_dvobj:
- usb_dvobj_deinit(pusb_intf);
-exit:
- return -ENODEV;
}
/*