From: Jisheng Zhang <jszhang@marvell.com>
To: <paulz@synopsys.com>, <gregkh@linuxfoundation.org>,
<stern@rowland.harvard.edu>, <mathias.nyman@intel.com>
Cc: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Jisheng Zhang <jszhang@marvell.com>
Subject: [PATCH] usb: Use dma_zalloc_coherent
Date: Wed, 12 Nov 2014 19:37:20 +0800 [thread overview]
Message-ID: <1415792240-6835-1-git-send-email-jszhang@marvell.com> (raw)
Use the zeroing version instead of dma_alloc_coherent and memset() as 0.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
drivers/usb/dwc2/hcd_ddma.c | 5 +----
drivers/usb/host/uhci-hcd.c | 3 +--
drivers/usb/host/xhci-mem.c | 3 +--
3 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c
index 3376177..d17e3cf 100644
--- a/drivers/usb/dwc2/hcd_ddma.c
+++ b/drivers/usb/dwc2/hcd_ddma.c
@@ -87,7 +87,7 @@ static u16 dwc2_frame_incr_val(struct dwc2_qh *qh)
static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
gfp_t flags)
{
- qh->desc_list = dma_alloc_coherent(hsotg->dev,
+ qh->desc_list = dma_zalloc_coherent(hsotg->dev,
sizeof(struct dwc2_hcd_dma_desc) *
dwc2_max_desc_num(qh), &qh->desc_list_dma,
flags);
@@ -95,9 +95,6 @@ static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
if (!qh->desc_list)
return -ENOMEM;
- memset(qh->desc_list, 0,
- sizeof(struct dwc2_hcd_dma_desc) * dwc2_max_desc_num(qh));
-
qh->n_bytes = kzalloc(sizeof(u32) * dwc2_max_desc_num(qh), flags);
if (!qh->n_bytes) {
dma_free_coherent(hsotg->dev, sizeof(struct dwc2_hcd_dma_desc)
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index a7de8e8..1d055f4 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -589,7 +589,7 @@ static int uhci_start(struct usb_hcd *hcd)
uhci->dentry = dentry;
#endif
- uhci->frame = dma_alloc_coherent(uhci_dev(uhci),
+ uhci->frame = dma_zalloc_coherent(uhci_dev(uhci),
UHCI_NUMFRAMES * sizeof(*uhci->frame),
&uhci->frame_dma_handle, GFP_KERNEL);
if (!uhci->frame) {
@@ -597,7 +597,6 @@ static int uhci_start(struct usb_hcd *hcd)
"unable to allocate consistent memory for frame list\n");
goto err_alloc_frame;
}
- memset(uhci->frame, 0, UHCI_NUMFRAMES * sizeof(*uhci->frame));
uhci->frame_cpu = kcalloc(UHCI_NUMFRAMES, sizeof(*uhci->frame_cpu),
GFP_KERNEL);
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 5cb3d7a..183ada4 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -2455,7 +2455,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
if (xhci_check_trb_in_td_math(xhci, flags) < 0)
goto fail;
- xhci->erst.entries = dma_alloc_coherent(dev,
+ xhci->erst.entries = dma_zalloc_coherent(dev,
sizeof(struct xhci_erst_entry) * ERST_NUM_SEGS, &dma,
GFP_KERNEL);
if (!xhci->erst.entries)
@@ -2464,7 +2464,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
"// Allocated event ring segment table at 0x%llx",
(unsigned long long)dma);
- memset(xhci->erst.entries, 0, sizeof(struct xhci_erst_entry)*ERST_NUM_SEGS);
xhci->erst.num_entries = ERST_NUM_SEGS;
xhci->erst.erst_dma_addr = dma;
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
--
2.1.3
reply other threads:[~2014-11-12 11:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415792240-6835-1-git-send-email-jszhang@marvell.com \
--to=jszhang@marvell.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=paulz@synopsys.com \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®