public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver
@ 2020-12-09 10:58 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2020-12-09 10:58 UTC (permalink / raw)
  To: pawell; +Cc: linux-usb

Hello Pawel Laszczak,

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)
                                                      ^^^^^^^^^^^

  1207  {
  1208          struct device *dev = pdev->dev;
  1209          int ret = -ENOMEM;
  1210          unsigned int val;
  1211          dma_addr_t dma;
  1212          u32 page_size;
  1213          u64 val_64;
  1214  
  1215          /*
  1216           * Use 4K pages, since that's common and the minimum the
  1217           * controller supports
  1218           */
  1219          page_size = 1 << 12;
  1220  
  1221          val = readl(&pdev->op_regs->config_reg);
  1222          val |= ((val & ~MAX_DEVS) | CDNSP_DEV_MAX_SLOTS) | CONFIG_U3E;
  1223          writel(val, &pdev->op_regs->config_reg);
  1224  
  1225          /*
  1226           * Doorbell array must be physically contiguous
  1227           * and 64-byte (cache line) aligned.
  1228           */
  1229          pdev->dcbaa = dma_alloc_coherent(dev, sizeof(*pdev->dcbaa),
  1230                                           &dma, GFP_KERNEL);

There is only one caller for cdnsp_mem_init() and flags is GFP_KERNEL.
It's better to just remove the argument because it's not useful.

  1231          if (!pdev->dcbaa)
  1232                  return -ENOMEM;
  1233  
  1234          memset(pdev->dcbaa, 0, sizeof(*pdev->dcbaa));
  1235          pdev->dcbaa->dma = dma;
  1236  
  1237          cdnsp_write_64(dma, &pdev->op_regs->dcbaa_ptr);
  1238  
  1239          /*
  1240           * Initialize the ring segment pool.  The ring must be a contiguous
  1241           * structure comprised of TRBs. The TRBs must be 16 byte aligned,
  1242           * however, the command ring segment needs 64-byte aligned segments
  1243           * and our use of dma addresses in the trb_address_map radix tree needs
  1244           * TRB_SEGMENT_SIZE alignment, so driver pick the greater alignment
  1245           * need.
  1246           */
  1247          pdev->segment_pool = dma_pool_create("CDNSP ring segments", dev,
  1248                                               TRB_SEGMENT_SIZE, TRB_SEGMENT_SIZE,
  1249                                               page_size);

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-09 10:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-09 10:58 [bug report] usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox