diff mbox series

[-next] usb: cdnsp: Removes some not useful function arguments

Message ID 20201209121858.23792-1-pawell@cadence.com (mailing list archive)
State Accepted
Commit dc68ba6c72366e0402fbcc4783a8b6ab610265df
Headers show
Series [-next] usb: cdnsp: Removes some not useful function arguments | expand

Commit Message

Pawel Laszczak Dec. 9, 2020, 12:18 p.m. UTC
This patch removes 'flags' argument from some functions and use
indirect the correct GFP_XXX flag to fix the following warning:

'The patch d40a169aab24: "usb: cdnsp: cdns3 Add main part of Cadence
USBSSP DRD Driver" from Dec 7, 2020, leads to the following static
checker warning:

	drivers/usb/cdns3/cdnsp-mem.c:1229 cdnsp_mem_init()
	warn: use 'flags' here instead of GFP_XXX?

drivers/usb/cdns3/cdnsp-mem.c
  1206  int cdnsp_mem_init(struct cdnsp_device *pdev, gfp_t flags);'
                                                      ^^^^^^^^^^^
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/usb/cdns3/cdnsp-gadget.c |  2 +-
 drivers/usb/cdns3/cdnsp-gadget.h |  2 +-
 drivers/usb/cdns3/cdnsp-mem.c    | 23 +++++++++++------------
 3 files changed, 13 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c
index c7c5d0a29f4d..1668f72fdf30 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.c
+++ b/drivers/usb/cdns3/cdnsp-gadget.c
@@ -1824,7 +1824,7 @@  static int cdnsp_gen_setup(struct cdnsp_device *pdev)
 
 	spin_lock_init(&pdev->lock);
 
-	ret = cdnsp_mem_init(pdev, GFP_KERNEL);
+	ret = cdnsp_mem_init(pdev);
 	if (ret)
 		return ret;
 
diff --git a/drivers/usb/cdns3/cdnsp-gadget.h b/drivers/usb/cdns3/cdnsp-gadget.h
index 5f8629eae41f..8eb1b85a08b4 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.h
+++ b/drivers/usb/cdns3/cdnsp-gadget.h
@@ -1480,7 +1480,7 @@  static inline void cdnsp_write_64(const u64 val, __le64 __iomem *regs)
 
 /* CDNSP memory management functions. */
 void cdnsp_mem_cleanup(struct cdnsp_device *pdev);
-int cdnsp_mem_init(struct cdnsp_device *pdev, gfp_t flags);
+int cdnsp_mem_init(struct cdnsp_device *pdev);
 int cdnsp_setup_addressable_priv_dev(struct cdnsp_device *pdev);
 void cdnsp_copy_ep0_dequeue_into_input_ctx(struct cdnsp_device *pdev);
 void cdnsp_endpoint_zero(struct cdnsp_device *pdev, struct cdnsp_ep *ep);
diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
index 6a0a12e1f54c..980047b7e416 100644
--- a/drivers/usb/cdns3/cdnsp-mem.c
+++ b/drivers/usb/cdns3/cdnsp-mem.c
@@ -684,7 +684,7 @@  static void cdnsp_free_priv_device(struct cdnsp_device *pdev)
 	pdev->out_ctx.bytes = NULL;
 }
 
-static int cdnsp_alloc_priv_device(struct cdnsp_device *pdev, gfp_t flags)
+static int cdnsp_alloc_priv_device(struct cdnsp_device *pdev)
 {
 	int ret = -ENOMEM;
 
@@ -693,7 +693,7 @@  static int cdnsp_alloc_priv_device(struct cdnsp_device *pdev, gfp_t flags)
 		return ret;
 
 	/* Allocate endpoint 0 ring. */
-	pdev->eps[0].ring = cdnsp_ring_alloc(pdev, 2, TYPE_CTRL, 0, flags);
+	pdev->eps[0].ring = cdnsp_ring_alloc(pdev, 2, TYPE_CTRL, 0, GFP_ATOMIC);
 	if (!pdev->eps[0].ring)
 		goto fail;
 
@@ -1020,8 +1020,7 @@  void cdnsp_endpoint_zero(struct cdnsp_device *pdev, struct cdnsp_ep *pep)
 
 static int cdnsp_alloc_erst(struct cdnsp_device *pdev,
 			    struct cdnsp_ring *evt_ring,
-			    struct cdnsp_erst *erst,
-			    gfp_t flags)
+			    struct cdnsp_erst *erst)
 {
 	struct cdnsp_erst_entry *entry;
 	struct cdnsp_segment *seg;
@@ -1030,7 +1029,7 @@  static int cdnsp_alloc_erst(struct cdnsp_device *pdev,
 
 	size = sizeof(struct cdnsp_erst_entry) * evt_ring->num_segs;
 	erst->entries = dma_alloc_coherent(pdev->dev, size,
-					   &erst->erst_dma_addr, flags);
+					   &erst->erst_dma_addr, GFP_KERNEL);
 	if (!erst->entries)
 		return -ENOMEM;
 
@@ -1142,7 +1141,7 @@  static void cdnsp_add_in_port(struct cdnsp_device *pdev,
  * Scan the Extended Capabilities for the "Supported Protocol Capabilities" that
  * specify what speeds each port is supposed to be.
  */
-static int cdnsp_setup_port_arrays(struct cdnsp_device *pdev, gfp_t flags)
+static int cdnsp_setup_port_arrays(struct cdnsp_device *pdev)
 {
 	void __iomem *base;
 	u32 offset;
@@ -1203,7 +1202,7 @@  static int cdnsp_setup_port_arrays(struct cdnsp_device *pdev, gfp_t flags)
  * device contexts, set up a command ring segment, create event
  * ring (one for now).
  */
-int cdnsp_mem_init(struct cdnsp_device *pdev, gfp_t flags)
+int cdnsp_mem_init(struct cdnsp_device *pdev)
 {
 	struct device *dev = pdev->dev;
 	int ret = -ENOMEM;
@@ -1255,7 +1254,7 @@  int cdnsp_mem_init(struct cdnsp_device *pdev, gfp_t flags)
 		goto mem_init_fail;
 
 	/* Set up the command ring to have one segments for now. */
-	pdev->cmd_ring = cdnsp_ring_alloc(pdev, 1, TYPE_COMMAND, 0, flags);
+	pdev->cmd_ring = cdnsp_ring_alloc(pdev, 1, TYPE_COMMAND, 0, GFP_KERNEL);
 	if (!pdev->cmd_ring)
 		goto mem_init_fail;
 
@@ -1278,11 +1277,11 @@  int cdnsp_mem_init(struct cdnsp_device *pdev, gfp_t flags)
 	 * the event ring segment table (ERST).
 	 */
 	pdev->event_ring = cdnsp_ring_alloc(pdev, ERST_NUM_SEGS, TYPE_EVENT,
-					    0, flags);
+					    0, GFP_KERNEL);
 	if (!pdev->event_ring)
 		goto mem_init_fail;
 
-	ret = cdnsp_alloc_erst(pdev, pdev->event_ring, &pdev->erst, flags);
+	ret = cdnsp_alloc_erst(pdev, pdev->event_ring, &pdev->erst);
 	if (ret)
 		goto mem_init_fail;
 
@@ -1301,11 +1300,11 @@  int cdnsp_mem_init(struct cdnsp_device *pdev, gfp_t flags)
 	/* Set the event ring dequeue address. */
 	cdnsp_set_event_deq(pdev);
 
-	ret = cdnsp_setup_port_arrays(pdev, flags);
+	ret = cdnsp_setup_port_arrays(pdev);
 	if (ret)
 		goto mem_init_fail;
 
-	ret = cdnsp_alloc_priv_device(pdev, GFP_ATOMIC);
+	ret = cdnsp_alloc_priv_device(pdev);
 	if (ret) {
 		dev_err(pdev->dev,
 			"Could not allocate cdnsp_device data structures\n");