From: Sekhar Nori <nsekhar@ti.com>
To: Pawel Laszczak <pawell@cadence.com>, <devicetree@vger.kernel.org>
Cc: <gregkh@linuxfoundation.org>, <felipe.balbi@linux.intel.com>,
<mark.rutland@arm.com>, <linux-usb@vger.kernel.org>,
<hdegoede@redhat.com>, <heikki.krogerus@linux.intel.com>,
<andy.shevchenko@gmail.com>, <robh+dt@kernel.org>,
<rogerq@ti.com>, <linux-kernel@vger.kernel.org>,
<jbergsagel@ti.com>, <nm@ti.com>, <sureshp@cadence.com>,
<peter.chen@nxp.com>, <kurahul@cadence.com>
Subject: Re: [PATCH v6 5/6] usb:cdns3 Add Cadence USB3 DRD Driver
Date: Tue, 4 Jun 2019 13:16:09 +0530 [thread overview]
Message-ID: <b768bde9-d6c8-f655-aecb-d08bcb9286a6@ti.com> (raw)
In-Reply-To: <1554882504-9010-6-git-send-email-pawell@cadence.com>
On 10/04/19 1:18 PM, Pawel Laszczak wrote:
> +static void cdns3_wa1_tray_restore_cycle_bit(struct cdns3_device *priv_dev,
> + struct cdns3_endpoint *priv_ep)
> +{
> + int dma_index;
> + u32 doorbell;
> +
> + doorbell = !!(readl(&priv_dev->regs->ep_cmd) & EP_CMD_DRDY);
> + dma_index = (readl(&priv_dev->regs->ep_traddr) -
> + priv_ep->trb_pool_dma) / TRB_SIZE;
This gets upgraded to 64-bit by 64-bit division whenever dma_addr_t is
64-bit. That should be avoided. Following diff should fix it.
But please review the logic itself. You are subtracting a 64 bit entity
from a 32-bit entity. What is guaranteeing that priv_ep->trb_pool_dma is
32-bit?
There is one more instance of same issue in cdns3_request_handled().
Thanks,
Sekhar
[1]
diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index bfd5dbf40c7e..e73b618501fb 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -749,8 +749,8 @@ static void cdns3_wa1_tray_restore_cycle_bit(struct cdns3_device *priv_dev,
u32 doorbell;
doorbell = !!(readl(&priv_dev->regs->ep_cmd) & EP_CMD_DRDY);
- dma_index = (readl(&priv_dev->regs->ep_traddr) -
- priv_ep->trb_pool_dma) / TRB_SIZE;
+ dma_index = readl(&priv_dev->regs->ep_traddr) - priv_ep->trb_pool_dma;
+ dma_index /= TRB_SIZE;
next prev parent reply other threads:[~2019-06-04 7:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-10 7:48 [PATCH v6 0/6] Introduced new Cadence USBSS " Pawel Laszczak
2019-04-10 7:48 ` [PATCH v6 1/6] dt-bindings: add binding for USBSS-DRD controller Pawel Laszczak
2019-04-26 9:21 ` Roger Quadros
2019-04-26 10:39 ` Pawel Laszczak
2019-04-10 7:48 ` [PATCH v6 2/6] usb:common Separated decoding functions from dwc3 driver Pawel Laszczak
2019-04-10 7:48 ` [PATCH v6 3/6] usb:common Patch simplify usb_decode_set_clear_feature function Pawel Laszczak
2019-04-10 7:48 ` [PATCH v6 4/6] usb:common Simplify usb_decode_get_set_descriptor function Pawel Laszczak
2019-04-10 7:48 ` [PATCH v6 5/6] usb:cdns3 Add Cadence USB3 DRD Driver Pawel Laszczak
2019-04-10 10:40 ` Lars Melin
2019-06-04 7:46 ` Sekhar Nori [this message]
2019-06-04 8:17 ` Pawel Laszczak
2019-06-04 8:24 ` Sekhar Nori
2019-06-04 8:38 ` Pawel Laszczak
2019-04-10 7:48 ` [PATCH v6 6/6] usb:cdns3 Fix for stuck packets in on-chip OUT buffer Pawel Laszczak
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=b768bde9-d6c8-f655-aecb-d08bcb9286a6@ti.com \
--to=nsekhar@ti.com \
--cc=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=felipe.balbi@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=jbergsagel@ti.com \
--cc=kurahul@cadence.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=nm@ti.com \
--cc=pawell@cadence.com \
--cc=peter.chen@nxp.com \
--cc=robh+dt@kernel.org \
--cc=rogerq@ti.com \
--cc=sureshp@cadence.com \
/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®