[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210407170531.29356-9-martin@kaiser.cx>
Date: Wed, 7 Apr 2021 19:05:30 +0200
From: Martin Kaiser <martin@...ser.cx>
To: Larry Finger <Larry.Finger@...inger.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-staging@...ts.linux.dev, kernel-janitors@...r.kernel.org,
linux-kernel@...r.kernel.org, Martin Kaiser <martin@...ser.cx>
Subject: [PATCH 09/10] 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@...ser.cx>
---
drivers/staging/rtl8188eu/os_dep/usb_intf.c | 26 ++++++++-------------
1 file 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;
}
/*
--
2.20.1
Powered by blists - more mailing lists