diff options
author | 2020-05-27 11:06:19 +0200 | |
---|---|---|
committer | 2020-05-27 12:24:45 +0200 | |
commit | a0dbe1b24c9b66102243ba8b49783f960edc8663 (patch) | |
tree | 6ac661c97271b75b6d68feacde676a7c927f5419 /drivers/staging/most | |
parent | staging: most: usb: change order of function parameters (diff) | |
download | linux-a0dbe1b24c9b66102243ba8b49783f960edc8663.tar.gz linux-a0dbe1b24c9b66102243ba8b49783f960edc8663.tar.bz2 linux-a0dbe1b24c9b66102243ba8b49783f960edc8663.zip |
staging: most: usb: don't use expressions that might fail in a declaration
This patch moves function calls that can fail out of the declararion block
of a function body. This is done to enhance readability.
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/1590570387-27069-3-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most')
-rw-r--r-- | drivers/staging/most/usb/usb.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c index 0e1264dc1231..fd0d8855ab44 100644 --- a/drivers/staging/most/usb/usb.c +++ b/drivers/staging/most/usb/usb.c @@ -139,9 +139,10 @@ static void wq_netinfo(struct work_struct *wq_obj); static inline int drci_rd_reg(struct usb_device *dev, u16 reg, u16 *buf) { int retval; - __le16 *dma_buf = kzalloc(sizeof(*dma_buf), GFP_KERNEL); + __le16 *dma_buf; u8 req_type = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE; + dma_buf = kzalloc(sizeof(*dma_buf), GFP_KERNEL); if (!dma_buf) return -ENOMEM; @@ -846,8 +847,9 @@ static ssize_t value_store(struct device *dev, struct device_attribute *attr, const char *name = attr->attr.name; struct most_dci_obj *dci_obj = to_dci_obj(dev); struct usb_device *usb_dev = dci_obj->usb_device; - int err = kstrtou16(buf, 16, &val); + int err; + err = kstrtou16(buf, 16, &val); if (err) return err; @@ -939,13 +941,14 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id) struct usb_host_interface *usb_iface_desc = interface->cur_altsetting; struct usb_device *usb_dev = interface_to_usbdev(interface); struct device *dev = &usb_dev->dev; - struct most_dev *mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); + struct most_dev *mdev; unsigned int i; unsigned int num_endpoints; struct most_channel_capability *tmp_cap; struct usb_endpoint_descriptor *ep_desc; int ret = -ENOMEM; + mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); if (!mdev) return -ENOMEM; |