summaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/musb_cppi41.c
diff options
context:
space:
mode:
authorRasmus Villemoes2014-11-27 22:25:45 +0100
committerFelipe Balbi2014-12-22 17:25:37 +0100
commite87c3f80ad0490d26ffe04754b7d094463b40f30 (patch)
treedd12c2eb2b2439a5bbcfae0188e6f3c1429e9d02 /drivers/usb/musb/musb_cppi41.c
parentusb: musb: blackfin: fix build break (diff)
downloadkernel-qcow2-linux-e87c3f80ad0490d26ffe04754b7d094463b40f30.tar.gz
kernel-qcow2-linux-e87c3f80ad0490d26ffe04754b7d094463b40f30.tar.xz
kernel-qcow2-linux-e87c3f80ad0490d26ffe04754b7d094463b40f30.zip
usb: musb: Fix a few off-by-one lengths
!strncmp(buf, "force host", 9) is true if and only if buf starts with "force hos". This was obviously not what was intended. The same error exists for "force full-speed", "force high-speed" and "test packet". Using strstarts avoids the error-prone hardcoding of the prefix length. For consistency, also change the other occurences of the !strncmp idiom. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/musb_cppi41.c')
-rw-r--r--drivers/usb/musb/musb_cppi41.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index f64fd964dc6d..c39a16ad7832 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -628,9 +628,9 @@ static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller)
ret = of_property_read_string_index(np, "dma-names", i, &str);
if (ret)
goto err;
- if (!strncmp(str, "tx", 2))
+ if (strstarts(str, "tx"))
is_tx = 1;
- else if (!strncmp(str, "rx", 2))
+ else if (strstarts(str, "rx"))
is_tx = 0;
else {
dev_err(dev, "Wrong dmatype %s\n", str);