Re: USB: xhci: Add tests for TRB address translation.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 03, 2009 at 10:02:27PM -0800, Sarah Sharp wrote:
> 
> It's not surprising that the transfer request buffer (TRB) physical to
> virtual address translation function has bugs in it, since I wrote most of
> it at 4am last October.  Add a test suite to check the TRB math.  This
> runs at memory initialization time, and causes the driver to fail to load
> if the TRB math fails.
> 
> Please excuse the excessively long lines in the test vectors; they can't
> really be made shorter and still be readable.
> 
> Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

This patch causes 3 build warnings on my system, so I'm not going to
apply it.

> +static int xhci_test_trb_in_td(struct xhci_hcd *xhci,
> +		struct xhci_segment *input_seg,
> +		union xhci_trb *start_trb,
> +		union xhci_trb *end_trb,
> +		dma_addr_t input_dma,
> +		struct xhci_segment *result_seg,
> +		char *test_name, int test_number)
> +{
> +		unsigned long long start_dma;
> +		unsigned long long end_dma;
> +		struct xhci_segment *seg;
> +
> +		start_dma = xhci_trb_virt_to_dma(input_seg, start_trb);
> +		end_dma = xhci_trb_virt_to_dma(input_seg, end_trb);
> +
> +		seg = trb_in_td(input_seg, start_trb, end_trb, input_dma);
> +		if (seg != result_seg) {
> +			xhci_warn(xhci, "WARN: %s TRB math test %d failed!\n",
> +					test_name, test_number);
> +			xhci_warn(xhci, "Tested TRB math w/ seg %p and "
> +					"input DMA 0x%llx\n",
> +					input_seg, input_dma);
> +			xhci_warn(xhci, "starting TRB %p (0x%llx DMA), "
> +					"ending TRB %p (0x%llx DMA)\n",
> +					start_trb, start_dma,
> +					end_trb, end_dma);
> +			xhci_warn(xhci, "Expected seg %p, got seg %p\n",
> +					result_seg, seg);
> +			return -1;
> +		}
> +}

Here's the big problem, indentation is wrong and you can exit the
function without returning a value :(

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux