linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] staging: most: usb: fix issues found in code audit
@ 2020-05-14 15:18 Christian Gromm
  2020-05-14 15:18 ` [PATCH v2 1/7] staging: most: usb: use dev_*() functions to print messages Christian Gromm
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Christian Gromm @ 2020-05-14 15:18 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, linux-usb, Christian Gromm

This series fixes the comments/findings on the previously submitted code
of the USB adapter driver. The fixes should be applied in staging before
moving the driver out as one patch.

v2:
	modded patch 2/7

Christian Gromm (7):
  staging: most: usb: use dev_*() functions to print messages
  staging: most: usb: remove reference to USB error codes
  staging: most: usb: check number of reported endpoints
  staging: most: usb: use dev_dbg function
  staging: most: fix typo in Kconfig
  staging: most: usb: use macro ATTRIBUTE_GROUPS
  Documentation: ABI: correct sysfs attribute description of MOST driver

 Documentation/ABI/testing/sysfs-bus-most | 104 ++++++++++----------
 drivers/staging/most/usb/Kconfig         |   2 +-
 drivers/staging/most/usb/usb.c           | 159 ++++++-------------------------
 3 files changed, 81 insertions(+), 184 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/7] staging: most: usb: use dev_*() functions to print messages
  2020-05-14 15:18 [PATCH v2 0/7] staging: most: usb: fix issues found in code audit Christian Gromm
@ 2020-05-14 15:18 ` Christian Gromm
  2020-05-14 15:18 ` [PATCH v2 2/7] staging: most: usb: remove reference to USB error codes Christian Gromm
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Christian Gromm @ 2020-05-14 15:18 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, linux-usb, Christian Gromm

This patch removes the pr_*() functions and uses dev_*() instead.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
v2:

 drivers/staging/most/usb/usb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index a4bf362..85d4fa0 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -5,7 +5,6 @@
  * Copyright (C) 2013-2015 Microchip Technology Germany II GmbH & Co. KG
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/usb.h>
@@ -186,13 +185,14 @@ static inline int start_sync_ep(struct usb_device *usb_dev, u16 ep)
  * get_stream_frame_size - calculate frame size of current configuration
  * @cfg: channel configuration
  */
-static unsigned int get_stream_frame_size(struct most_channel_config *cfg)
+static unsigned int get_stream_frame_size(struct most_channel_config *cfg,
+					  struct device *dev)
 {
 	unsigned int frame_size = 0;
 	unsigned int sub_size = cfg->subbuffer_size;
 
 	if (!sub_size) {
-		pr_warn("Misconfig: Subbuffer size zero.\n");
+		dev_warn(dev, "Misconfig: Subbuffer size zero.\n");
 		return frame_size;
 	}
 	switch (cfg->data_type) {
@@ -201,7 +201,7 @@ static unsigned int get_stream_frame_size(struct most_channel_config *cfg)
 		break;
 	case MOST_CH_SYNC:
 		if (cfg->packets_per_xact == 0) {
-			pr_warn("Misconfig: Packets per XACT zero\n");
+			dev_warn(dev, "Misconfig: Packets per XACT zero\n");
 			frame_size = 0;
 		} else if (cfg->packets_per_xact == 0xFF) {
 			frame_size = (USB_MTU / sub_size) * sub_size;
@@ -210,7 +210,7 @@ static unsigned int get_stream_frame_size(struct most_channel_config *cfg)
 		}
 		break;
 	default:
-		pr_warn("Query frame size of non-streaming channel\n");
+		dev_warn(dev, "Query frame size of non-streaming channel\n");
 		break;
 	}
 	return frame_size;
@@ -270,7 +270,7 @@ static int hdm_poison_channel(struct most_interface *iface, int channel)
 static int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
 {
 	struct most_channel_config *conf = &mdev->conf[channel];
-	unsigned int frame_size = get_stream_frame_size(conf);
+	unsigned int frame_size = get_stream_frame_size(conf, &mdev->dev);
 	unsigned int j, num_frames;
 
 	if (!frame_size)
@@ -304,7 +304,7 @@ static int hdm_remove_padding(struct most_dev *mdev, int channel,
 			      struct mbo *mbo)
 {
 	struct most_channel_config *const conf = &mdev->conf[channel];
-	unsigned int frame_size = get_stream_frame_size(conf);
+	unsigned int frame_size = get_stream_frame_size(conf, &mdev->dev);
 	unsigned int j, num_frames;
 
 	if (!frame_size)
@@ -697,7 +697,7 @@ static int hdm_configure_channel(struct most_interface *iface, int channel,
 
 	mdev->padding_active[channel] = true;
 
-	frame_size = get_stream_frame_size(conf);
+	frame_size = get_stream_frame_size(conf, &mdev->dev);
 	if (frame_size == 0 || frame_size > USB_MTU) {
 		dev_warn(dev, "Misconfig: frame size wrong\n");
 		return -EINVAL;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/7] staging: most: usb: remove reference to USB error codes
  2020-05-14 15:18 [PATCH v2 0/7] staging: most: usb: fix issues found in code audit Christian Gromm
  2020-05-14 15:18 ` [PATCH v2 1/7] staging: most: usb: use dev_*() functions to print messages Christian Gromm
@ 2020-05-14 15:18 ` Christian Gromm
  2020-05-14 15:18 ` [PATCH v2 3/7] staging: most: usb: check number of reported endpoints Christian Gromm
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Christian Gromm @ 2020-05-14 15:18 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, linux-usb, Christian Gromm

This patch removes the reference to the driver API file for USB error
codes.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
v2:
	removed copied USB error code section

 drivers/staging/most/usb/usb.c | 97 ------------------------------------------
 1 file changed, 97 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 85d4fa0..dbb6003 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -382,103 +382,6 @@ static void hdm_write_completion(struct urb *urb)
  * padding bytes -if necessary- and calls the completion function.
  *
  * Context: interrupt!
- *
- * **************************************************************************
- *                   Error codes returned by in urb->status
- *                   or in iso_frame_desc[n].status (for ISO)
- * *************************************************************************
- *
- * USB device drivers may only test urb status values in completion handlers.
- * This is because otherwise there would be a race between HCDs updating
- * these values on one CPU, and device drivers testing them on another CPU.
- *
- * A transfer's actual_length may be positive even when an error has been
- * reported.  That's because transfers often involve several packets, so that
- * one or more packets could finish before an error stops further endpoint I/O.
- *
- * For isochronous URBs, the urb status value is non-zero only if the URB is
- * unlinked, the device is removed, the host controller is disabled or the total
- * transferred length is less than the requested length and the URB_SHORT_NOT_OK
- * flag is set.  Completion handlers for isochronous URBs should only see
- * urb->status set to zero, -ENOENT, -ECONNRESET, -ESHUTDOWN, or -EREMOTEIO.
- * Individual frame descriptor status fields may report more status codes.
- *
- *
- * 0			Transfer completed successfully
- *
- * -ENOENT		URB was synchronously unlinked by usb_unlink_urb
- *
- * -EINPROGRESS		URB still pending, no results yet
- *			(That is, if drivers see this it's a bug.)
- *
- * -EPROTO (*, **)	a) bitstuff error
- *			b) no response packet received within the
- *			   prescribed bus turn-around time
- *			c) unknown USB error
- *
- * -EILSEQ (*, **)	a) CRC mismatch
- *			b) no response packet received within the
- *			   prescribed bus turn-around time
- *			c) unknown USB error
- *
- *			Note that often the controller hardware does not
- *			distinguish among cases a), b), and c), so a
- *			driver cannot tell whether there was a protocol
- *			error, a failure to respond (often caused by
- *			device disconnect), or some other fault.
- *
- * -ETIME (**)		No response packet received within the prescribed
- *			bus turn-around time.  This error may instead be
- *			reported as -EPROTO or -EILSEQ.
- *
- * -ETIMEDOUT		Synchronous USB message functions use this code
- *			to indicate timeout expired before the transfer
- *			completed, and no other error was reported by HC.
- *
- * -EPIPE (**)		Endpoint stalled.  For non-control endpoints,
- *			reset this status with usb_clear_halt().
- *
- * -ECOMM		During an IN transfer, the host controller
- *			received data from an endpoint faster than it
- *			could be written to system memory
- *
- * -ENOSR		During an OUT transfer, the host controller
- *			could not retrieve data from system memory fast
- *			enough to keep up with the USB data rate
- *
- * -EOVERFLOW (*)	The amount of data returned by the endpoint was
- *			greater than either the max packet size of the
- *			endpoint or the remaining buffer size.  "Babble".
- *
- * -EREMOTEIO		The data read from the endpoint did not fill the
- *			specified buffer, and URB_SHORT_NOT_OK was set in
- *			urb->transfer_flags.
- *
- * -ENODEV		Device was removed.  Often preceded by a burst of
- *			other errors, since the hub driver doesn't detect
- *			device removal events immediately.
- *
- * -EXDEV		ISO transfer only partially completed
- *			(only set in iso_frame_desc[n].status, not urb->status)
- *
- * -EINVAL		ISO madness, if this happens: Log off and go home
- *
- * -ECONNRESET		URB was asynchronously unlinked by usb_unlink_urb
- *
- * -ESHUTDOWN		The device or host controller has been disabled due
- *			to some problem that could not be worked around,
- *			such as a physical disconnect.
- *
- *
- * (*) Error codes like -EPROTO, -EILSEQ and -EOVERFLOW normally indicate
- * hardware problems such as bad devices (including firmware) or cables.
- *
- * (**) This is also one of several codes that different kinds of host
- * controller use to indicate a transfer has failed because of device
- * disconnect.  In the interval before the hub driver starts disconnect
- * processing, devices may receive such fault reports for every request.
- *
- * See <https://www.kernel.org/doc/Documentation/driver-api/usb/error-codes.rst>
  */
 static void hdm_read_completion(struct urb *urb)
 {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/7] staging: most: usb: check number of reported endpoints
  2020-05-14 15:18 [PATCH v2 0/7] staging: most: usb: fix issues found in code audit Christian Gromm
  2020-05-14 15:18 ` [PATCH v2 1/7] staging: most: usb: use dev_*() functions to print messages Christian Gromm
  2020-05-14 15:18 ` [PATCH v2 2/7] staging: most: usb: remove reference to USB error codes Christian Gromm
@ 2020-05-14 15:18 ` Christian Gromm
  2020-05-15  1:10   ` kbuild test robot
  2020-05-14 15:18 ` [PATCH v2 4/7] staging: most: usb: use dev_dbg function Christian Gromm
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Christian Gromm @ 2020-05-14 15:18 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, linux-usb, Christian Gromm

This patch checks the number of endpoints reported by the USB
interface descriptor and throws an error if the number exceeds
MAX_NUM_ENDPOINTS.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
v2:

 drivers/staging/most/usb/usb.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index dbb6003..d5c73cb 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -950,13 +950,17 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 	unsigned int num_endpoints;
 	struct most_channel_capability *tmp_cap;
 	struct usb_endpoint_descriptor *ep_desc;
-	int ret = 0;
+	int ret;
 
 	if (!mdev)
-		goto err_out_of_memory;
+		return -ENOMEM;
 
 	usb_set_intfdata(interface, mdev);
 	num_endpoints = usb_iface_desc->desc.bNumEndpoints;
+	if (num_endpoints > MAX_NUM_ENDPOINTS) {
+		kfree(mdev);
+		return -EINVAL;
+	}
 	mutex_init(&mdev->io_mutex);
 	INIT_WORK(&mdev->poll_work_obj, wq_netinfo);
 	timer_setup(&mdev->link_stat_timer, link_stat_timer_handler, 0);
@@ -1085,11 +1089,6 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 	kfree(mdev->conf);
 err_free_mdev:
 	put_device(&mdev->dev);
-err_out_of_memory:
-	if (ret == 0 || ret == -ENOMEM) {
-		ret = -ENOMEM;
-		dev_err(dev, "out of memory\n");
-	}
 	return ret;
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 4/7] staging: most: usb: use dev_dbg function
  2020-05-14 15:18 [PATCH v2 0/7] staging: most: usb: fix issues found in code audit Christian Gromm
                   ` (2 preceding siblings ...)
  2020-05-14 15:18 ` [PATCH v2 3/7] staging: most: usb: check number of reported endpoints Christian Gromm
@ 2020-05-14 15:18 ` Christian Gromm
  2020-05-14 15:18 ` [PATCH v2 5/7] staging: most: fix typo in Kconfig Christian Gromm
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Christian Gromm @ 2020-05-14 15:18 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, linux-usb, Christian Gromm

This patch replaces the functions dev_notice with dev_dbg to silence
the driver during normal operation.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
v2:

 drivers/staging/most/usb/usb.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index d5c73cb..c3a7e71 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -1035,17 +1035,17 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 		init_usb_anchor(&mdev->busy_urbs[i]);
 		spin_lock_init(&mdev->channel_lock[i]);
 	}
-	dev_notice(dev, "claimed gadget: Vendor=%4.4x ProdID=%4.4x Bus=%02x Device=%02x\n",
-		   le16_to_cpu(usb_dev->descriptor.idVendor),
-		   le16_to_cpu(usb_dev->descriptor.idProduct),
-		   usb_dev->bus->busnum,
-		   usb_dev->devnum);
-
-	dev_notice(dev, "device path: /sys/bus/usb/devices/%d-%s:%d.%d\n",
-		   usb_dev->bus->busnum,
-		   usb_dev->devpath,
-		   usb_dev->config->desc.bConfigurationValue,
-		   usb_iface_desc->desc.bInterfaceNumber);
+	dev_dbg(dev, "claimed gadget: Vendor=%4.4x ProdID=%4.4x Bus=%02x Device=%02x\n",
+		le16_to_cpu(usb_dev->descriptor.idVendor),
+		le16_to_cpu(usb_dev->descriptor.idProduct),
+		usb_dev->bus->busnum,
+		usb_dev->devnum);
+
+	dev_dbg(dev, "device path: /sys/bus/usb/devices/%d-%s:%d.%d\n",
+		usb_dev->bus->busnum,
+		usb_dev->devpath,
+		usb_dev->config->desc.bConfigurationValue,
+		usb_iface_desc->desc.bInterfaceNumber);
 
 	ret = most_register_interface(&mdev->iface);
 	if (ret)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 5/7] staging: most: fix typo in Kconfig
  2020-05-14 15:18 [PATCH v2 0/7] staging: most: usb: fix issues found in code audit Christian Gromm
                   ` (3 preceding siblings ...)
  2020-05-14 15:18 ` [PATCH v2 4/7] staging: most: usb: use dev_dbg function Christian Gromm
@ 2020-05-14 15:18 ` Christian Gromm
  2020-05-14 15:18 ` [PATCH v2 6/7] staging: most: usb: use macro ATTRIBUTE_GROUPS Christian Gromm
  2020-05-14 15:18 ` [PATCH v2 7/7] Documentation: ABI: correct sysfs attribute description of MOST driver Christian Gromm
  6 siblings, 0 replies; 9+ messages in thread
From: Christian Gromm @ 2020-05-14 15:18 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, linux-usb, Christian Gromm

This patch corrects the typo in the Kconfig file where it says
tranceiver instead of transceiver.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
---
v2:

 drivers/staging/most/usb/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/usb/Kconfig b/drivers/staging/most/usb/Kconfig
index a86f1f6..75dc25c 100644
--- a/drivers/staging/most/usb/Kconfig
+++ b/drivers/staging/most/usb/Kconfig
@@ -7,7 +7,7 @@ config MOST_USB
 	tristate "USB"
 	depends on USB && NET
 	help
-	  Say Y here if you want to connect via USB to network tranceiver.
+	  Say Y here if you want to connect via USB to network transceiver.
 	  This device driver depends on the networking AIM.
 
 	  To compile this driver as a module, choose M here: the
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 6/7] staging: most: usb: use macro ATTRIBUTE_GROUPS
  2020-05-14 15:18 [PATCH v2 0/7] staging: most: usb: fix issues found in code audit Christian Gromm
                   ` (4 preceding siblings ...)
  2020-05-14 15:18 ` [PATCH v2 5/7] staging: most: fix typo in Kconfig Christian Gromm
@ 2020-05-14 15:18 ` Christian Gromm
  2020-05-14 15:18 ` [PATCH v2 7/7] Documentation: ABI: correct sysfs attribute description of MOST driver Christian Gromm
  6 siblings, 0 replies; 9+ messages in thread
From: Christian Gromm @ 2020-05-14 15:18 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, linux-usb, Christian Gromm

This patch makes use of the macro ATTRIBUTE_GROUPS to create the groups
instead of defining them manually.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
v2:

 drivers/staging/most/usb/usb.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index c3a7e71..43f535f 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -905,14 +905,7 @@ static struct attribute *dci_attrs[] = {
 	NULL,
 };
 
-static struct attribute_group dci_attr_group = {
-	.attrs = dci_attrs,
-};
-
-static const struct attribute_group *dci_attr_groups[] = {
-	&dci_attr_group,
-	NULL,
-};
+ATTRIBUTE_GROUPS(dci);
 
 static void release_dci(struct device *dev)
 {
@@ -1065,7 +1058,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 
 		mdev->dci->dev.init_name = "dci";
 		mdev->dci->dev.parent = get_device(mdev->iface.dev);
-		mdev->dci->dev.groups = dci_attr_groups;
+		mdev->dci->dev.groups = dci_groups;
 		mdev->dci->dev.release = release_dci;
 		if (device_register(&mdev->dci->dev)) {
 			mutex_unlock(&mdev->io_mutex);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 7/7] Documentation: ABI: correct sysfs attribute description of MOST driver
  2020-05-14 15:18 [PATCH v2 0/7] staging: most: usb: fix issues found in code audit Christian Gromm
                   ` (5 preceding siblings ...)
  2020-05-14 15:18 ` [PATCH v2 6/7] staging: most: usb: use macro ATTRIBUTE_GROUPS Christian Gromm
@ 2020-05-14 15:18 ` Christian Gromm
  6 siblings, 0 replies; 9+ messages in thread
From: Christian Gromm @ 2020-05-14 15:18 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, linux-usb, Christian Gromm

This patch fixes the ABI description file sysfs-bus-most.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v2:

 Documentation/ABI/testing/sysfs-bus-most | 104 ++++++++++++++++---------------
 1 file changed, 53 insertions(+), 51 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-bus-most b/Documentation/ABI/testing/sysfs-bus-most
index 6b1d06e..ec0a603 100644
--- a/Documentation/ABI/testing/sysfs-bus-most
+++ b/Documentation/ABI/testing/sysfs-bus-most
@@ -1,14 +1,14 @@
-What:		/sys/bus/most/devices/.../description
+What:		/sys/bus/most/devices/<dev>/description
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		Provides information about the interface type and the physical
-		location of the device. Hardware attached via USB, for instance,
+		Provides information about the physical location of the
+		device. Hardware attached via USB, for instance,
 		might return <1-1.1:1.0>
 Users:
 
-What:		/sys/bus/most/devices/.../interface
+What:		/sys/bus/most/devices/<dev>/interface
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -16,7 +16,7 @@ Description:
 		Indicates the type of peripheral interface the device uses.
 Users:
 
-What:		/sys/bus/most/devices/.../dci
+What:		/sys/bus/most/devices/<dev>/dci
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -26,7 +26,7 @@ Description:
 		write the controller's DCI registers.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/arb_address
+What:		/sys/bus/most/devices/<dev>/dci/arb_address
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -35,7 +35,7 @@ Description:
 		application wants to read from or write to.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/arb_value
+What:		/sys/bus/most/devices/<dev>/dci/arb_value
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -44,7 +44,7 @@ Description:
 		is stored in arb_address.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/mep_eui48_hi
+What:		/sys/bus/most/devices/<dev>/dci/mep_eui48_hi
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -52,7 +52,7 @@ Description:
 		This is used to check and configure the MAC address.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/mep_eui48_lo
+What:		/sys/bus/most/devices/<dev>/dci/mep_eui48_lo
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -60,7 +60,7 @@ Description:
 		This is used to check and configure the MAC address.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/mep_eui48_mi
+What:		/sys/bus/most/devices/<dev>/dci/mep_eui48_mi
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -68,7 +68,7 @@ Description:
 		This is used to check and configure the MAC address.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/mep_filter
+What:		/sys/bus/most/devices/<dev>/dci/mep_filter
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -76,7 +76,7 @@ Description:
 		This is used to check and configure the MEP filter address.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/mep_hash0
+What:		/sys/bus/most/devices/<dev>/dci/mep_hash0
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -84,7 +84,7 @@ Description:
 		This is used to check and configure the MEP hash table.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/mep_hash1
+What:		/sys/bus/most/devices/<dev>/dci/mep_hash1
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -92,7 +92,7 @@ Description:
 		This is used to check and configure the MEP hash table.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/mep_hash2
+What:		/sys/bus/most/devices/<dev>/dci/mep_hash2
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -100,7 +100,7 @@ Description:
 		This is used to check and configure the MEP hash table.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/mep_hash3
+What:		/sys/bus/most/devices/<dev>/dci/mep_hash3
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -108,7 +108,7 @@ Description:
 		This is used to check and configure the MEP hash table.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/ni_state
+What:		/sys/bus/most/devices/<dev>/dci/ni_state
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -116,7 +116,7 @@ Description:
 		Indicates the current network interface state.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/node_address
+What:		/sys/bus/most/devices/<dev>/dci/node_address
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -124,7 +124,7 @@ Description:
 		Indicates the current node address.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/node_position
+What:		/sys/bus/most/devices/<dev>/dci/node_position
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -132,7 +132,7 @@ Description:
 		Indicates the current node position.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/packet_bandwidth
+What:		/sys/bus/most/devices/<dev>/dci/packet_bandwidth
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -140,7 +140,7 @@ Description:
 		Indicates the configured packet bandwidth.
 Users:
 
-What:		/sys/bus/most/devices/.../dci/sync_ep
+What:		/sys/bus/most/devices/<dev>/dci/sync_ep
 Date:		June 2016
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -149,7 +149,7 @@ Description:
 		endpoint.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/
+What:		/sys/bus/most/devices/<dev>/<channel>/
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -160,91 +160,92 @@ Description:
 		configure it.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/available_datatypes
+What:		/sys/bus/most/devices/<dev>/<channel>/available_datatypes
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		Indicates the data types the current channel can transport.
+		Indicates the data types the channel can transport.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/available_directions
+What:		/sys/bus/most/devices/<dev>/<channel>/available_directions
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		Indicates the directions the current channel is capable of.
+		Indicates the directions the channel is capable of.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/number_of_packet_buffers
+What:		/sys/bus/most/devices/<dev>/<channel>/number_of_packet_buffers
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		Indicates the number of packet buffers the current channel can
+		Indicates the number of packet buffers the channel can
 		handle.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/number_of_stream_buffers
+What:		/sys/bus/most/devices/<dev>/<channel>/number_of_stream_buffers
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		Indicates the number of streaming buffers the current channel can
+		Indicates the number of streaming buffers the channel can
 		handle.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/size_of_packet_buffer
+What:		/sys/bus/most/devices/<dev>/<channel>/size_of_packet_buffer
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		Indicates the size of a packet buffer the current channel can
+		Indicates the size of a packet buffer the channel can
 		handle.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/size_of_stream_buffer
+What:		/sys/bus/most/devices/<dev>/<channel>/size_of_stream_buffer
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		Indicates the size of a streaming buffer the current channel can
+		Indicates the size of a streaming buffer the channel can
 		handle.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/set_number_of_buffers
+What:		/sys/bus/most/devices/<dev>/<channel>/set_number_of_buffers
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		This is to configure the number of buffers of the current channel.
+		This is to read back the configured number of buffers of
+		the channel.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/set_buffer_size
+What:		/sys/bus/most/devices/<dev>/<channel>/set_buffer_size
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		This is to configure the size of a buffer of the current channel.
+		This is to read back the configured buffer size of the channel.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/set_direction
+What:		/sys/bus/most/devices/<dev>/<channel>/set_direction
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		This is to configure the direction of the current channel.
+		This is to read back the configured direction of the channel.
 		The following strings will be accepted:
-			'dir_tx',
-			'dir_rx'
+			'tx',
+			'rx'
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/set_datatype
+What:		/sys/bus/most/devices/<dev>/<channel>/set_datatype
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		This is to configure the data type of the current channel.
+		This is to read back the configured data type of the channel.
 		The following strings will be accepted:
 			'control',
 			'async',
@@ -252,30 +253,31 @@ Description:
 			'isoc_avp'
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/set_subbuffer_size
+What:		/sys/bus/most/devices/<dev>/<channel>/set_subbuffer_size
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		This is to configure the subbuffer size of the current channel.
+		This is to read back the configured subbuffer size of
+		the channel.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/set_packets_per_xact
+What:		/sys/bus/most/devices/<dev>/<channel>/set_packets_per_xact
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		This is to configure the number of packets per transaction of
-		the current channel. This is only needed network interface
-		controller is attached via USB.
+		This is to read back the configured number of packets per
+		transaction of the channel. This is only applicable when
+		connected via USB.
 Users:
 
-What:		/sys/bus/most/devices/.../<channel>/channel_starving
+What:		/sys/bus/most/devices/<dev>/<channel>/channel_starving
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
-		Indicates whether current channel ran out of buffers.
+		Indicates whether channel ran out of buffers.
 Users:
 
 What:		/sys/bus/most/drivers/most_core/components
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/7] staging: most: usb: check number of reported endpoints
  2020-05-14 15:18 ` [PATCH v2 3/7] staging: most: usb: check number of reported endpoints Christian Gromm
@ 2020-05-15  1:10   ` kbuild test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2020-05-15  1:10 UTC (permalink / raw)
  To: Christian Gromm, gregkh
  Cc: kbuild-all, clang-built-linux, driverdev-devel, linux-usb,
	Christian Gromm

[-- Attachment #1: Type: text/plain, Size: 24114 bytes --]

Hi Christian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on usb/usb-testing linus/master v5.7-rc5 next-20200514]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Christian-Gromm/staging-most-usb-fix-issues-found-in-code-audit/20200514-232235
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 8a01032e02c8a0fb3e9f33791023b62dee73cc03
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project a52f10b5a382c040e7ad1ce933cda6c07a4b3a8d)
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/staging/most/usb/usb.c:1010:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!mdev->busy_urbs)
^~~~~~~~~~~~~~~~
drivers/staging/most/usb/usb.c:1092:9: note: uninitialized use occurs here
return ret;
^~~
drivers/staging/most/usb/usb.c:1010:2: note: remove the 'if' if its condition is always false
if (!mdev->busy_urbs)
^~~~~~~~~~~~~~~~~~~~~
drivers/staging/most/usb/usb.c:1005:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!mdev->ep_address)
^~~~~~~~~~~~~~~~~
drivers/staging/most/usb/usb.c:1092:9: note: uninitialized use occurs here
return ret;
^~~
drivers/staging/most/usb/usb.c:1005:2: note: remove the 'if' if its condition is always false
if (!mdev->ep_address)
^~~~~~~~~~~~~~~~~~~~~~
drivers/staging/most/usb/usb.c:999:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!mdev->cap)
^~~~~~~~~~
drivers/staging/most/usb/usb.c:1092:9: note: uninitialized use occurs here
return ret;
^~~
drivers/staging/most/usb/usb.c:999:2: note: remove the 'if' if its condition is always false
if (!mdev->cap)
^~~~~~~~~~~~~~~
drivers/staging/most/usb/usb.c:995:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!mdev->conf)
^~~~~~~~~~~
drivers/staging/most/usb/usb.c:1092:9: note: uninitialized use occurs here
return ret;
^~~
drivers/staging/most/usb/usb.c:995:2: note: remove the 'if' if its condition is always false
if (!mdev->conf)
^~~~~~~~~~~~~~~~
drivers/staging/most/usb/usb.c:953:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
4 warnings generated.

vim +1010 drivers/staging/most/usb/usb.c

869d3acd488c28 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-28   923  
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23   924  static void release_mdev(struct device *dev)
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23   925  {
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23   926  	struct most_dev *mdev = to_mdev_from_dev(dev);
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23   927  
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23   928  	kfree(mdev);
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23   929  }
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   930  /**
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   931   * hdm_probe - probe function of USB device driver
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   932   * @interface: Interface of the attached USB device
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   933   * @id: Pointer to the USB ID table.
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   934   *
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   935   * This allocates and initializes the device instance, adds the new
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   936   * entry to the internal list, scans the USB descriptors and registers
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   937   * the interface with the core.
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   938   * Additionally, the DCI objects are created and the hardware is sync'd.
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   939   *
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   940   * Return 0 on success. In case of an error a negative number is returned.
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   941   */
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   942  static int
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   943  hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   944  {
089612f183efb4 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-08-19   945  	struct usb_host_interface *usb_iface_desc = interface->cur_altsetting;
089612f183efb4 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-08-19   946  	struct usb_device *usb_dev = interface_to_usbdev(interface);
089612f183efb4 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-08-19   947  	struct device *dev = &usb_dev->dev;
089612f183efb4 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-08-19   948  	struct most_dev *mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   949  	unsigned int i;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   950  	unsigned int num_endpoints;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   951  	struct most_channel_capability *tmp_cap;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   952  	struct usb_endpoint_descriptor *ep_desc;
7f704bf88cc1a9 drivers/staging/most/usb/usb.c         Christian Gromm 2020-05-14   953  	int ret;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   954  
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   955  	if (!mdev)
7f704bf88cc1a9 drivers/staging/most/usb/usb.c         Christian Gromm 2020-05-14   956  		return -ENOMEM;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   957  
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   958  	usb_set_intfdata(interface, mdev);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   959  	num_endpoints = usb_iface_desc->desc.bNumEndpoints;
7f704bf88cc1a9 drivers/staging/most/usb/usb.c         Christian Gromm 2020-05-14   960  	if (num_endpoints > MAX_NUM_ENDPOINTS) {
7f704bf88cc1a9 drivers/staging/most/usb/usb.c         Christian Gromm 2020-05-14   961  		kfree(mdev);
7f704bf88cc1a9 drivers/staging/most/usb/usb.c         Christian Gromm 2020-05-14   962  		return -EINVAL;
7f704bf88cc1a9 drivers/staging/most/usb/usb.c         Christian Gromm 2020-05-14   963  	}
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   964  	mutex_init(&mdev->io_mutex);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   965  	INIT_WORK(&mdev->poll_work_obj, wq_netinfo);
e99e88a9d2b067 drivers/staging/most/hdm-usb/hdm_usb.c Kees Cook       2017-10-16   966  	timer_setup(&mdev->link_stat_timer, link_stat_timer_handler, 0);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   967  
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   968  	mdev->usb_device = usb_dev;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   969  	mdev->link_stat_timer.expires = jiffies + (2 * HZ);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   970  
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   971  	mdev->iface.mod = hdm_usb_fops.owner;
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23   972  	mdev->iface.dev = &mdev->dev;
69c90cf1b2faf5 drivers/staging/most/usb/usb.c         Christian Gromm 2018-05-08   973  	mdev->iface.driver_dev = &interface->dev;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   974  	mdev->iface.interface = ITYPE_USB;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   975  	mdev->iface.configure = hdm_configure_channel;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   976  	mdev->iface.request_netinfo = hdm_request_netinfo;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   977  	mdev->iface.enqueue = hdm_enqueue;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   978  	mdev->iface.poison_channel = hdm_poison_channel;
3598cec585f8d5 drivers/staging/most/usb/usb.c         Christian Gromm 2018-05-08   979  	mdev->iface.dma_alloc = hdm_dma_alloc;
3598cec585f8d5 drivers/staging/most/usb/usb.c         Christian Gromm 2018-05-08   980  	mdev->iface.dma_free = hdm_dma_free;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   981  	mdev->iface.description = mdev->description;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   982  	mdev->iface.num_channels = num_endpoints;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   983  
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   984  	snprintf(mdev->description, sizeof(mdev->description),
5b082c2e07d851 drivers/staging/most/usb/usb.c         Christian Gromm 2019-04-03   985  		 "%d-%s:%d.%d",
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   986  		 usb_dev->bus->busnum,
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   987  		 usb_dev->devpath,
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   988  		 usb_dev->config->desc.bConfigurationValue,
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   989  		 usb_iface_desc->desc.bInterfaceNumber);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   990  
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23   991  	mdev->dev.init_name = mdev->description;
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23   992  	mdev->dev.parent = &interface->dev;
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23   993  	mdev->dev.release = release_mdev;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   994  	mdev->conf = kcalloc(num_endpoints, sizeof(*mdev->conf), GFP_KERNEL);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   995  	if (!mdev->conf)
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21   996  		goto err_free_mdev;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   997  
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   998  	mdev->cap = kcalloc(num_endpoints, sizeof(*mdev->cap), GFP_KERNEL);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24   999  	if (!mdev->cap)
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1000  		goto err_free_conf;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1001  
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1002  	mdev->iface.channel_vector = mdev->cap;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1003  	mdev->ep_address =
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1004  		kcalloc(num_endpoints, sizeof(*mdev->ep_address), GFP_KERNEL);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1005  	if (!mdev->ep_address)
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1006  		goto err_free_cap;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1007  
27e6245e35bc6c drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-09-19  1008  	mdev->busy_urbs =
27e6245e35bc6c drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-09-19  1009  		kcalloc(num_endpoints, sizeof(*mdev->busy_urbs), GFP_KERNEL);
27e6245e35bc6c drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-09-19 @1010  	if (!mdev->busy_urbs)
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1011  		goto err_free_ep_address;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1012  
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1013  	tmp_cap = mdev->cap;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1014  	for (i = 0; i < num_endpoints; i++) {
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1015  		ep_desc = &usb_iface_desc->endpoint[i].desc;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1016  		mdev->ep_address[i] = ep_desc->bEndpointAddress;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1017  		mdev->padding_active[i] = false;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1018  		mdev->is_channel_healthy[i] = true;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1019  
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1020  		snprintf(&mdev->suffix[i][0], MAX_SUFFIX_LEN, "ep%02x",
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1021  			 mdev->ep_address[i]);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1022  
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1023  		tmp_cap->name_suffix = &mdev->suffix[i][0];
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1024  		tmp_cap->buffer_size_packet = MAX_BUF_SIZE;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1025  		tmp_cap->buffer_size_streaming = MAX_BUF_SIZE;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1026  		tmp_cap->num_buffers_packet = BUF_CHAIN_SIZE;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1027  		tmp_cap->num_buffers_streaming = BUF_CHAIN_SIZE;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1028  		tmp_cap->data_type = MOST_CH_CONTROL | MOST_CH_ASYNC |
0540609fe217c3 drivers/staging/most/hdm-usb/hdm_usb.c Andrey Shvetsov 2016-09-21  1029  				     MOST_CH_ISOC | MOST_CH_SYNC;
afd14cef0156bc drivers/staging/most/hdm-usb/hdm_usb.c Sandhya Bankar  2016-03-06  1030  		if (usb_endpoint_dir_in(ep_desc))
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1031  			tmp_cap->direction = MOST_CH_RX;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1032  		else
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1033  			tmp_cap->direction = MOST_CH_TX;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1034  		tmp_cap++;
27e6245e35bc6c drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-09-19  1035  		init_usb_anchor(&mdev->busy_urbs[i]);
88d1878bcaa438 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-09-19  1036  		spin_lock_init(&mdev->channel_lock[i]);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1037  	}
59ed0480b95032 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-30  1038  	dev_notice(dev, "claimed gadget: Vendor=%4.4x ProdID=%4.4x Bus=%02x Device=%02x\n",
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1039  		   le16_to_cpu(usb_dev->descriptor.idVendor),
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1040  		   le16_to_cpu(usb_dev->descriptor.idProduct),
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1041  		   usb_dev->bus->busnum,
59ed0480b95032 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-30  1042  		   usb_dev->devnum);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1043  
59ed0480b95032 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-30  1044  	dev_notice(dev, "device path: /sys/bus/usb/devices/%d-%s:%d.%d\n",
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1045  		   usb_dev->bus->busnum,
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1046  		   usb_dev->devpath,
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1047  		   usb_dev->config->desc.bConfigurationValue,
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1048  		   usb_iface_desc->desc.bInterfaceNumber);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1049  
4d5f022f3a664e drivers/staging/most/usb/usb.c         Christian Gromm 2017-11-21  1050  	ret = most_register_interface(&mdev->iface);
4d5f022f3a664e drivers/staging/most/usb/usb.c         Christian Gromm 2017-11-21  1051  	if (ret)
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1052  		goto err_free_busy_urbs;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1053  
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1054  	mutex_lock(&mdev->io_mutex);
654f7ec4b3b8ac drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-08-19  1055  	if (le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81118 ||
5bf9bd8d19834f drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-08-19  1056  	    le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81119 ||
5bf9bd8d19834f drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-08-19  1057  	    le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81210) {
4d5f022f3a664e drivers/staging/most/usb/usb.c         Christian Gromm 2017-11-21  1058  		mdev->dci = kzalloc(sizeof(*mdev->dci), GFP_KERNEL);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1059  		if (!mdev->dci) {
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1060  			mutex_unlock(&mdev->io_mutex);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1061  			most_deregister_interface(&mdev->iface);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1062  			ret = -ENOMEM;
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1063  			goto err_free_busy_urbs;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1064  		}
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1065  
4d5f022f3a664e drivers/staging/most/usb/usb.c         Christian Gromm 2017-11-21  1066  		mdev->dci->dev.init_name = "dci";
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23  1067  		mdev->dci->dev.parent = get_device(mdev->iface.dev);
4d5f022f3a664e drivers/staging/most/usb/usb.c         Christian Gromm 2017-11-21  1068  		mdev->dci->dev.groups = dci_attr_groups;
869d3acd488c28 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-28  1069  		mdev->dci->dev.release = release_dci;
4d5f022f3a664e drivers/staging/most/usb/usb.c         Christian Gromm 2017-11-21  1070  		if (device_register(&mdev->dci->dev)) {
4d5f022f3a664e drivers/staging/most/usb/usb.c         Christian Gromm 2017-11-21  1071  			mutex_unlock(&mdev->io_mutex);
4d5f022f3a664e drivers/staging/most/usb/usb.c         Christian Gromm 2017-11-21  1072  			most_deregister_interface(&mdev->iface);
4d5f022f3a664e drivers/staging/most/usb/usb.c         Christian Gromm 2017-11-21  1073  			ret = -ENOMEM;
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1074  			goto err_free_dci;
4d5f022f3a664e drivers/staging/most/usb/usb.c         Christian Gromm 2017-11-21  1075  		}
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1076  		mdev->dci->usb_device = mdev->usb_device;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1077  	}
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1078  	mutex_unlock(&mdev->io_mutex);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1079  	return 0;
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1080  err_free_dci:
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23  1081  	put_device(&mdev->dci->dev);
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1082  err_free_busy_urbs:
27e6245e35bc6c drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2016-09-19  1083  	kfree(mdev->busy_urbs);
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1084  err_free_ep_address:
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1085  	kfree(mdev->ep_address);
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1086  err_free_cap:
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1087  	kfree(mdev->cap);
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1088  err_free_conf:
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1089  	kfree(mdev->conf);
bddd3c2546e9c4 drivers/staging/most/usb/usb.c         Christian Gromm 2018-09-21  1090  err_free_mdev:
723de0f9171eeb drivers/staging/most/usb/usb.c         Christian Gromm 2020-01-23  1091  	put_device(&mdev->dev);
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1092  	return ret;
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1093  }
a4198cdf0c3460 drivers/staging/most/hdm-usb/hdm_usb.c Christian Gromm 2015-07-24  1094  

:::::: The code at line 1010 was first introduced by commit
:::::: 27e6245e35bc6c20c2933d7d8afa562623be1ef5 staging: most: hdm-usb: remove proprietary urb anchoring

:::::: TO: Christian Gromm <christian.gromm@microchip.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 73499 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-05-15  1:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 15:18 [PATCH v2 0/7] staging: most: usb: fix issues found in code audit Christian Gromm
2020-05-14 15:18 ` [PATCH v2 1/7] staging: most: usb: use dev_*() functions to print messages Christian Gromm
2020-05-14 15:18 ` [PATCH v2 2/7] staging: most: usb: remove reference to USB error codes Christian Gromm
2020-05-14 15:18 ` [PATCH v2 3/7] staging: most: usb: check number of reported endpoints Christian Gromm
2020-05-15  1:10   ` kbuild test robot
2020-05-14 15:18 ` [PATCH v2 4/7] staging: most: usb: use dev_dbg function Christian Gromm
2020-05-14 15:18 ` [PATCH v2 5/7] staging: most: fix typo in Kconfig Christian Gromm
2020-05-14 15:18 ` [PATCH v2 6/7] staging: most: usb: use macro ATTRIBUTE_GROUPS Christian Gromm
2020-05-14 15:18 ` [PATCH v2 7/7] Documentation: ABI: correct sysfs attribute description of MOST driver Christian Gromm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).