[Please leave Alan and the Linux USB mailing list Cc'ed, since I asked
for Alan's advice on this.]
On Wed, May 15, 2013 at 07:50:39AM +0300, Xenia Ragiadakou wrote:
> I will try to clarify more my question.
>
> In xhci.c: 4665 states that:
>
> if (HCC_64BIT_ADDR(temp)) {
> xhci_dbg(xhci, "Enabling 64-bit DMA addresses.\n");
> dma_set_mask(hcd->self.controller, DMA_BIT_MASK(64));
> } else {
> dma_set_mask(hcd->self.controller, DMA_BIT_MASK(32));
> }
> }
>
> Is there a possibility for the dma_set_mask function to fail,
> so that it will be necessary to check for this condition :
>
> if (HCC_64BIT_ADDR(temp)) {
> xhci_dbg(xhci, "Enabling 64-bit DMA addresses.\n");
> if (dma_set_mask(hcd->self.controller, DMA_BIT_MASK(64)))
> goto error;
> } else {
> if (dma_set_mask(hcd->self.controller, DMA_BIT_MASK(32)))
> goto error;
> }
> }
In theory, yes, dma_set_mask() could fail. It would have to be a pretty
broken xHCI host that indicates it supports 64-bits when it doesn't.
Perhaps in the 64-bit case, you want to try to enable 32-bit DMA on
failure? If that fails, then bail out.
Since the DMA setup code is copy-pasted twice in xhci_gen_setup(),
perhaps you want to refactor the DMA setup into its own function as a
separate patch on top of your bug fix?
Sarah Sharp
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html