Skip to contentSkip to conversation

usb: gadget: sdp: add missing line breaks

PATCH New Andre Heider 3 participants 8 messages Feb 15, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 usb: gadget: sdp: add missing line breaks

Cosmetic change.

---
 cmd/usb_gadget_sdp.c       |  4 ++--
 common/spl/spl_sdp.c       |  4 ++--
 drivers/usb/gadget/f_sdp.c | 14 +++++++-------
 3 files changed, 11 insertions(+), 11 deletions(-)
cmd/usb_gadget_sdp.c +2 -2
index ae4d73c125..97d00ec545 100644
@@ -28,13 +28,13 @@ static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	ret = sdp_init(controller_index);
 	if (ret) {
-		pr_err("SDP init failed: %d", ret);
+		pr_err("SDP init failed: %d\n", ret);
 		goto exit;
 	}
 
 	/* This command typically does not return but jumps to an image */
 	sdp_handle(controller_index);
-	pr_err("SDP ended");
+	pr_err("SDP ended\n");
 
 exit:
 	g_dnl_unregister();
common/spl/spl_sdp.c +2 -2
index 333d518f4d..0c4603a3db 100644
@@ -24,13 +24,13 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,
 
 	ret = sdp_init(controller_index);
 	if (ret) {
-		pr_err("SDP init failed: %d", ret);
+		pr_err("SDP init failed: %d\n", ret);
 		return -ENODEV;
 	}
 
 	/* This command typically does not return but jumps to an image */
 	sdp_handle(controller_index);
-	pr_err("SDP ended");
+	pr_err("SDP ended\n");
 
 	return -EINVAL;
 }
drivers/usb/gadget/f_sdp.c +7 -7
index dd7b9cddb1..6da0530095 100644
@@ -238,12 +238,12 @@ static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req)
 	u8 report = data[0];
 
 	if (status != 0) {
-		pr_err("Status: %d", status);
+		pr_err("Status: %d\n", status);
 		return;
 	}
 
 	if (report != 1) {
-		pr_err("Unexpected report %d", report);
+		pr_err("Unexpected report %d\n", report);
 		return;
 	}
 
@@ -323,12 +323,12 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req)
 	int datalen = req->length - 1;
 
 	if (status != 0) {
-		pr_err("Status: %d", status);
+		pr_err("Status: %d\n", status);
 		return;
 	}
 
 	if (report != 2) {
-		pr_err("Unexpected report %d", report);
+		pr_err("Unexpected report %d\n", report);
 		return;
 	}
 
@@ -361,7 +361,7 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req)
 		sdp->state = SDP_STATE_TX_SEC_CONF;
 		break;
 	default:
-		pr_err("Invalid state: %d", sdp->state);
+		pr_err("Invalid state: %d\n", sdp->state);
 	}
 }
 
@@ -371,7 +371,7 @@ static void sdp_tx_complete(struct usb_ep *ep, struct usb_request *req)
 	int status = req->status;
 
 	if (status != 0) {
-		pr_err("Status: %d", status);
+		pr_err("Status: %d\n", status);
 		return;
 	}
 
@@ -394,7 +394,7 @@ static void sdp_tx_complete(struct usb_ep *ep, struct usb_request *req)
 			sdp->state = SDP_STATE_IDLE;
 		break;
 	default:
-		pr_err("Wrong State: %d", sdp->state);
+		pr_err("Wrong State: %d\n", sdp->state);
 		sdp->state = SDP_STATE_IDLE;
 		break;
 	}
Signature · 1 line
2.16.1
#1 lore raw

PATCH 2/2 usb: gadget: sdp: fix pointer casts for 64bit archs

The SDP protocol contains multiple 32bit pointers. Add a helper function to get a valid pointer from these values and use it.

---
 drivers/usb/gadget/f_sdp.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/usb/gadget/f_sdp.c +9 -4
index 6da0530095..43c5cfbb77 100644
@@ -230,6 +230,11 @@ static struct usb_gadget_strings *sdp_generic_strings[] = {
 	NULL,
 };
 
+static inline void *sdp_ptr(u32 val)
+{
+	return (void *)(uintptr_t)val;
+}
+
 static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req)
 {
 	struct f_sdp *sdp = req->context;
@@ -344,7 +349,7 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req)
 	}
 
 	if (sdp->state == SDP_STATE_RX_FILE_DATA) {
-		memcpy((void *)sdp->dnl_address, req->buf + 1, datalen);
+		memcpy(sdp_ptr(sdp->dnl_address), req->buf + 1, datalen);
 		sdp->dnl_address += datalen;
 	}
 
@@ -622,7 +627,7 @@ static u32 sdp_jump_imxheader(void *address)
 	}
 
 	printf("Jumping to 0x%08x\n", headerv2->entry);
-	entry = (void *)headerv2->entry;
+	entry = sdp_ptr(headerv2->entry);
 	entry();
 
 	/* The image probably never returns hence we won't reach that point */
@@ -665,7 +670,7 @@ static void sdp_handle_in_ep(void)
 		if (datalen > 64)
 			datalen = 64;
 
-		memcpy(&data[1], (void *)sdp_func->dnl_address, datalen);
+		memcpy(&data[1], sdp_ptr(sdp_func->dnl_address), datalen);
 		sdp_func->in_req->length = 65;
 
 		sdp_func->dnl_bytes_remaining -= datalen;
@@ -676,7 +681,7 @@ static void sdp_handle_in_ep(void)
 		break;
 	case SDP_STATE_JUMP:
 		printf("Jumping to header at 0x%08x\n", sdp_func->jmp_address);
-		status = sdp_jump_imxheader((void *)sdp_func->jmp_address);
+		status = sdp_jump_imxheader(sdp_ptr(sdp_func->jmp_address));
 
 		/* If imx header fails, try some U-Boot specific headers */
 		if (status) {
Signature · 1 line
2.16.1
#2 lore raw

PATCH 2/2 usb: gadget: sdp: fix pointer casts for 64bit archs

Hi Andre,

Quoted 2 lines

The SDP protocol contains multiple 32bit pointers. Add a helper function to get a valid pointer from these values and use it.

Is there any special rationale behind this?

Quoted 11 lines
---
 drivers/usb/gadget/f_sdp.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/usb/gadget/f_sdp.c +0 -0
index 6da0530095..43c5cfbb77 100644

drivers/usb/gadget/f_sdp.c static struct usb_gadget_strings · line 236

Quoted 7 lines
drivers/usb/gadget/f_sdp.c +4 -0
@@ -230,6 +230,11 @@ static struct usb_gadget_strings
 *sdp_generic_strings[] = { NULL,
 };
 
+static inline void *sdp_ptr(u32 val)
+{
+	return (void *)(uintptr_t)val;
+}

From what I see from the code the (void *) cast shall be enough.

Quoted 42 lines
drivers/usb/gadget/f_sdp.c +3 -2
+
 static void sdp_rx_command_complete(struct usb_ep *ep, struct
 usb_request *req) {
 	struct f_sdp *sdp = req->context;
@@ -344,7 +349,7 @@ static void sdp_rx_data_complete(struct usb_ep
 *ep, struct usb_request *req) }
 
 	if (sdp->state == SDP_STATE_RX_FILE_DATA) {
-		memcpy((void *)sdp->dnl_address, req->buf + 1,
 datalen);
+		memcpy(sdp_ptr(sdp->dnl_address), req->buf + 1,
 datalen); sdp->dnl_address += datalen;
 	}
@@ -622,7 +627,7 @@ static u32 sdp_jump_imxheader(void *address)
 	}
 
 	printf("Jumping to 0x%08x\n", headerv2->entry);
-	entry = (void *)headerv2->entry;
+	entry = sdp_ptr(headerv2->entry);
 	entry();
 
 	/* The image probably never returns hence we won't reach

that point */ @@ -665,7 +670,7 @@ static void sdp_handle_in_ep(void)

drivers/usb/gadget/f_sdp.c +0 -1
 		if (datalen > 64)
 			datalen = 64;
 
-		memcpy(&data[1], (void *)sdp_func->dnl_address,

datalen);

drivers/usb/gadget/f_sdp.c +1 -0
+		memcpy(&data[1], sdp_ptr(sdp_func->dnl_address),

datalen); sdp_func->in_req->length = 65;

drivers/usb/gadget/f_sdp.c +1 -1
 		sdp_func->dnl_bytes_remaining -= datalen;
@@ -676,7 +681,7 @@ static void sdp_handle_in_ep(void)
 		break;
 	case SDP_STATE_JUMP:
 		printf("Jumping to header at 0x%08x\n",
 sdp_func->jmp_address);
-		status = sdp_jump_imxheader((void
 *)sdp_func->jmp_address);
+		status =
 sdp_jump_imxheader(sdp_ptr(sdp_func->jmp_address)); 
Quoted 2 lines

/* If imx header fails, try some U-Boot specific
headers */ if (status) {

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180215/e1fa5bc7/attachment.sig>

#3 lore raw

PATCH 2/2 usb: gadget: sdp: fix pointer casts for 64bit archs

Hi Lukasz,

Quoted 6 lines · Lukasz Majewski

Hi Andre,

Quoted 2 lines

The SDP protocol contains multiple 32bit pointers. Add a helper function to get a valid pointer from these values and use it.

Is there any special rationale behind this?

It's been a while, but if i remember correctly SDP worked on 64bit.

This fixes at least warnings on 64bit:
warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Should I reword that?

Thanks,
Andre

Quoted 80 lines
Quoted 12 lines
---
  drivers/usb/gadget/f_sdp.c | 13 +++++++++----
  1 file changed, 9 insertions(+), 4 deletions(-)
drivers/usb/gadget/f_sdp.c +0 -0
index 6da0530095..43c5cfbb77 100644

drivers/usb/gadget/f_sdp.c static struct usb_gadget_strings · line 236

Quoted 7 lines
drivers/usb/gadget/f_sdp.c +4 -0
@@ -230,6 +230,11 @@ static struct usb_gadget_strings
 *sdp_generic_strings[] = { NULL,
  };
 
+static inline void *sdp_ptr(u32 val)
+{
+	return (void *)(uintptr_t)val;
+}

From what I see from the code the (void *) cast shall be enough.

Quoted 42 lines
drivers/usb/gadget/f_sdp.c +3 -2
+
  static void sdp_rx_command_complete(struct usb_ep *ep, struct
 usb_request *req) {
  	struct f_sdp *sdp = req->context;
@@ -344,7 +349,7 @@ static void sdp_rx_data_complete(struct usb_ep
 *ep, struct usb_request *req) }
 
  	if (sdp->state == SDP_STATE_RX_FILE_DATA) {
-		memcpy((void *)sdp->dnl_address, req->buf + 1,
 datalen);
+		memcpy(sdp_ptr(sdp->dnl_address), req->buf + 1,
 datalen); sdp->dnl_address += datalen;
  	}
@@ -622,7 +627,7 @@ static u32 sdp_jump_imxheader(void *address)
  	}
 
  	printf("Jumping to 0x%08x\n", headerv2->entry);
-	entry = (void *)headerv2->entry;
+	entry = sdp_ptr(headerv2->entry);
  	entry();
 
  	/* The image probably never returns hence we won't reach

that point */ @@ -665,7 +670,7 @@ static void sdp_handle_in_ep(void)
if (datalen > 64)
datalen = 64;

drivers/usb/gadget/f_sdp.c +0 -1
-		memcpy(&data[1], (void *)sdp_func->dnl_address,

datalen);

drivers/usb/gadget/f_sdp.c +1 -0
+		memcpy(&data[1], sdp_ptr(sdp_func->dnl_address),

datalen); sdp_func->in_req->length = 65;

  		sdp_func->dnl_bytes_remaining -= datalen;
drivers/usb/gadget/f_sdp.c +1 -1
@@ -676,7 +681,7 @@ static void sdp_handle_in_ep(void)
  		break;
  	case SDP_STATE_JUMP:
  		printf("Jumping to header at 0x%08x\n",
 sdp_func->jmp_address);
-		status = sdp_jump_imxheader((void
 *)sdp_func->jmp_address);
+		status =
 sdp_jump_imxheader(sdp_ptr(sdp_func->jmp_address));
Quoted 2 lines

/* If imx header fails, try some U-Boot specific
headers */ if (status) {

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de

#4 lore raw

PATCH 2/2 usb: gadget: sdp: fix pointer casts for 64bit archs

Hi Andre,

Quoted 10 lines

Hi Lukasz,

Quoted 6 lines · Lukasz Majewski

Hi Andre,

Quoted 2 lines

The SDP protocol contains multiple 32bit pointers. Add a helper function to get a valid pointer from these values and use it.

Is there any special rationale behind this?

Quoted 7 lines

It's been a while, but if i remember correctly SDP worked on 64bit.

This fixes at least warnings on 64bit:
warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Should I reword that?

Yes, please.

Also please add the info regarding the warning, which we try to remove.

Best regards,
�ukasz Majewski

Quoted 85 lines

Thanks,
Andre

Quoted 80 lines
Quoted 12 lines
---
  drivers/usb/gadget/f_sdp.c | 13 +++++++++----
  1 file changed, 9 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/gadget/f_sdp.c index 6da0530095..43c5cfbb77 100644

drivers/usb/gadget/f_sdp.c static struct usb_gadget_strings · line 236

Quoted 7 lines
drivers/usb/gadget/f_sdp.c +4 -0
@@ -230,6 +230,11 @@ static struct usb_gadget_strings
 *sdp_generic_strings[] = { NULL,
  };
 
+static inline void *sdp_ptr(u32 val)
+{
+	return (void *)(uintptr_t)val;
+}  

From what I see from the code the (void *) cast shall be enough.

Quoted 42 lines
drivers/usb/gadget/f_sdp.c +3 -2
+
  static void sdp_rx_command_complete(struct usb_ep *ep, struct
 usb_request *req) {
  	struct f_sdp *sdp = req->context;
@@ -344,7 +349,7 @@ static void sdp_rx_data_complete(struct usb_ep
 *ep, struct usb_request *req) }
 
  	if (sdp->state == SDP_STATE_RX_FILE_DATA) {
-		memcpy((void *)sdp->dnl_address, req->buf + 1,
 datalen);
+		memcpy(sdp_ptr(sdp->dnl_address), req->buf + 1,
 datalen); sdp->dnl_address += datalen;
  	}
@@ -622,7 +627,7 @@ static u32 sdp_jump_imxheader(void *address)
  	}
 
  	printf("Jumping to 0x%08x\n", headerv2->entry);
-	entry = (void *)headerv2->entry;
+	entry = sdp_ptr(headerv2->entry);
  	entry();
 
  	/* The image probably never returns hence we won't reach

that point */ @@ -665,7 +670,7 @@ static void
sdp_handle_in_ep(void) if (datalen > 64)
datalen = 64;

drivers/usb/gadget/f_sdp.c +0 -1
-		memcpy(&data[1], (void *)sdp_func->dnl_address,

datalen);

drivers/usb/gadget/f_sdp.c +1 -0
+		memcpy(&data[1], sdp_ptr(sdp_func->dnl_address),

datalen); sdp_func->in_req->length = 65;

  		sdp_func->dnl_bytes_remaining -= datalen;
drivers/usb/gadget/f_sdp.c +1 -1
@@ -676,7 +681,7 @@ static void sdp_handle_in_ep(void)
  		break;
  	case SDP_STATE_JUMP:
  		printf("Jumping to header at 0x%08x\n",
 sdp_func->jmp_address);
-		status = sdp_jump_imxheader((void
 *)sdp_func->jmp_address);
+		status =
 sdp_jump_imxheader(sdp_ptr(sdp_func->jmp_address));
Quoted 2 lines

/* If imx header fails, try some U-Boot specific
headers */ if (status) {

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email:
wd at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180215/8ea5398d/attachment.sig>

#5 lore raw

PATCH v2 2/2 usb: gadget: sdp: fix pointer cast warnings for 64bit archs

In reply to Andre Heider

The SDP protocol contains multiple 32bit pointers. Add a helper function to get a valid pointer from these values and use it.

This fixes the following warnings:

drivers/usb/gadget/f_sdp.c: In function ‘sdp_rx_data_complete’:
drivers/usb/gadget/f_sdp.c:347:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

   memcpy((void *)sdp->dnl_address, req->buf + 1, datalen);
          ^
drivers/usb/gadget/f_sdp.c: In function ‘sdp_jump_imxheader’:
drivers/usb/gadget/f_sdp.c:625:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  entry = (void *)headerv2->entry;
          ^
drivers/usb/gadget/f_sdp.c: In function ‘sdp_handle_in_ep’:
drivers/usb/gadget/f_sdp.c:668:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   memcpy(&data[1], (void *)sdp_func->dnl_address, datalen);
                    ^
drivers/usb/gadget/f_sdp.c:679:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   status = sdp_jump_imxheader((void *)sdp_func->jmp_address);
                               ^
---
 drivers/usb/gadget/f_sdp.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/usb/gadget/f_sdp.c +9 -4
index 6da0530095..43c5cfbb77 100644
@@ -230,6 +230,11 @@ static struct usb_gadget_strings *sdp_generic_strings[] = {
 	NULL,
 };
 
+static inline void *sdp_ptr(u32 val)
+{
+	return (void *)(uintptr_t)val;
+}
+
 static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req)
 {
 	struct f_sdp *sdp = req->context;
@@ -344,7 +349,7 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req)
 	}
 
 	if (sdp->state == SDP_STATE_RX_FILE_DATA) {
-		memcpy((void *)sdp->dnl_address, req->buf + 1, datalen);
+		memcpy(sdp_ptr(sdp->dnl_address), req->buf + 1, datalen);
 		sdp->dnl_address += datalen;
 	}
 
@@ -622,7 +627,7 @@ static u32 sdp_jump_imxheader(void *address)
 	}
 
 	printf("Jumping to 0x%08x\n", headerv2->entry);
-	entry = (void *)headerv2->entry;
+	entry = sdp_ptr(headerv2->entry);
 	entry();
 
 	/* The image probably never returns hence we won't reach that point */
@@ -665,7 +670,7 @@ static void sdp_handle_in_ep(void)
 		if (datalen > 64)
 			datalen = 64;
 
-		memcpy(&data[1], (void *)sdp_func->dnl_address, datalen);
+		memcpy(&data[1], sdp_ptr(sdp_func->dnl_address), datalen);
 		sdp_func->in_req->length = 65;
 
 		sdp_func->dnl_bytes_remaining -= datalen;
@@ -676,7 +681,7 @@ static void sdp_handle_in_ep(void)
 		break;
 	case SDP_STATE_JUMP:
 		printf("Jumping to header at 0x%08x\n", sdp_func->jmp_address);
-		status = sdp_jump_imxheader((void *)sdp_func->jmp_address);
+		status = sdp_jump_imxheader(sdp_ptr(sdp_func->jmp_address));
 
 		/* If imx header fails, try some U-Boot specific headers */
 		if (status) {
Signature · 1 line
2.16.1
#6 lore raw

PATCH 1/2 usb: gadget: sdp: add missing line breaks

In reply to Andre Heider
Quoted 102 lines · On Thu, 15 Feb 2018 07:08:55 +0100 Andre Heider <[email protected]> wrote:

Cosmetic change.

---
 cmd/usb_gadget_sdp.c       |  4 ++--
 common/spl/spl_sdp.c       |  4 ++--
 drivers/usb/gadget/f_sdp.c | 14 +++++++-------
 3 files changed, 11 insertions(+), 11 deletions(-)
cmd/usb_gadget_sdp.c +2 -2
index ae4d73c125..97d00ec545 100644
@@ -28,13 +28,13 @@ static int do_sdp(cmd_tbl_t *cmdtp, int flag, int
 argc, char * const argv[]) 
 	ret = sdp_init(controller_index);
 	if (ret) {
-		pr_err("SDP init failed: %d", ret);
+		pr_err("SDP init failed: %d\n", ret);
 		goto exit;
 	}
 
 	/* This command typically does not return but jumps to an
 image */ sdp_handle(controller_index);
-	pr_err("SDP ended");
+	pr_err("SDP ended\n");
 
 exit:
 	g_dnl_unregister();
common/spl/spl_sdp.c +2 -2
index 333d518f4d..0c4603a3db 100644
@@ -24,13 +24,13 @@ static int spl_sdp_load_image(struct
 spl_image_info *spl_image, 
 	ret = sdp_init(controller_index);
 	if (ret) {
-		pr_err("SDP init failed: %d", ret);
+		pr_err("SDP init failed: %d\n", ret);
 		return -ENODEV;
 	}
 
 	/* This command typically does not return but jumps to an
 image */ sdp_handle(controller_index);
-	pr_err("SDP ended");
+	pr_err("SDP ended\n");
 
 	return -EINVAL;
 }
drivers/usb/gadget/f_sdp.c +6 -6
index dd7b9cddb1..6da0530095 100644
@@ -238,12 +238,12 @@ static void sdp_rx_command_complete(struct
 usb_ep *ep, struct usb_request *req) u8 report = data[0];
 
 	if (status != 0) {
-		pr_err("Status: %d", status);
+		pr_err("Status: %d\n", status);
 		return;
 	}
 
 	if (report != 1) {
-		pr_err("Unexpected report %d", report);
+		pr_err("Unexpected report %d\n", report);
 		return;
 	}
 
@@ -323,12 +323,12 @@ static void sdp_rx_data_complete(struct usb_ep
 *ep, struct usb_request *req) int datalen = req->length - 1;
 
 	if (status != 0) {
-		pr_err("Status: %d", status);
+		pr_err("Status: %d\n", status);
 		return;
 	}
 
 	if (report != 2) {
-		pr_err("Unexpected report %d", report);
+		pr_err("Unexpected report %d\n", report);
 		return;
 	}
 
@@ -361,7 +361,7 @@ static void sdp_rx_data_complete(struct usb_ep
 *ep, struct usb_request *req) sdp->state = SDP_STATE_TX_SEC_CONF;
 		break;
 	default:
-		pr_err("Invalid state: %d", sdp->state);
+		pr_err("Invalid state: %d\n", sdp->state);
 	}
 }
 
@@ -371,7 +371,7 @@ static void sdp_tx_complete(struct usb_ep *ep,
 struct usb_request *req) int status = req->status;
 
 	if (status != 0) {
-		pr_err("Status: %d", status);
+		pr_err("Status: %d\n", status);
 		return;
 	}
 

drivers/usb/gadget/f_sdp.c static void sdp_tx_complete(struct usb_ep *ep, · line 400

Quoted 8 lines
drivers/usb/gadget/f_sdp.c +1 -1
@@ -394,7 +394,7 @@ static void sdp_tx_complete(struct usb_ep *ep,
 struct usb_request *req) sdp->state = SDP_STATE_IDLE;
 		break;
 	default:
-		pr_err("Wrong State: %d", sdp->state);
+		pr_err("Wrong State: %d\n", sdp->state);
 		sdp->state = SDP_STATE_IDLE;
 		break;
 	}

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180215/2223037f/attachment.sig>

#7 lore raw

PATCH 1/2 usb: gadget: sdp: add missing line breaks

Quoted 4 lines · Lukasz Majewski
Quoted 1 line · On Thu, 15 Feb 2018 07:08:55 +0100 Andre Heider <[email protected]> wrote:

Cosmetic change.

Hm, this got introduced by
commit 9b643e312d52 ("treewide: replace with error() with pr_err()")

error() did print the newline...

Best regards,
Stefan

Quoted 121 lines
Quoted 101 lines
---
 cmd/usb_gadget_sdp.c       |  4 ++--
 common/spl/spl_sdp.c       |  4 ++--
 drivers/usb/gadget/f_sdp.c | 14 +++++++-------
 3 files changed, 11 insertions(+), 11 deletions(-)
cmd/usb_gadget_sdp.c +2 -2
index ae4d73c125..97d00ec545 100644
@@ -28,13 +28,13 @@ static int do_sdp(cmd_tbl_t *cmdtp, int flag, int
 argc, char * const argv[]) 
 	ret = sdp_init(controller_index);
 	if (ret) {
-		pr_err("SDP init failed: %d", ret);
+		pr_err("SDP init failed: %d\n", ret);
 		goto exit;
 	}
 
 	/* This command typically does not return but jumps to an
 image */ sdp_handle(controller_index);
-	pr_err("SDP ended");
+	pr_err("SDP ended\n");
 
 exit:
 	g_dnl_unregister();
common/spl/spl_sdp.c +2 -2
index 333d518f4d..0c4603a3db 100644
@@ -24,13 +24,13 @@ static int spl_sdp_load_image(struct
 spl_image_info *spl_image, 
 	ret = sdp_init(controller_index);
 	if (ret) {
-		pr_err("SDP init failed: %d", ret);
+		pr_err("SDP init failed: %d\n", ret);
 		return -ENODEV;
 	}
 
 	/* This command typically does not return but jumps to an
 image */ sdp_handle(controller_index);
-	pr_err("SDP ended");
+	pr_err("SDP ended\n");
 
 	return -EINVAL;
 }
drivers/usb/gadget/f_sdp.c +6 -6
index dd7b9cddb1..6da0530095 100644
@@ -238,12 +238,12 @@ static void sdp_rx_command_complete(struct
 usb_ep *ep, struct usb_request *req) u8 report = data[0];
 
 	if (status != 0) {
-		pr_err("Status: %d", status);
+		pr_err("Status: %d\n", status);
 		return;
 	}
 
 	if (report != 1) {
-		pr_err("Unexpected report %d", report);
+		pr_err("Unexpected report %d\n", report);
 		return;
 	}
 
@@ -323,12 +323,12 @@ static void sdp_rx_data_complete(struct usb_ep
 *ep, struct usb_request *req) int datalen = req->length - 1;
 
 	if (status != 0) {
-		pr_err("Status: %d", status);
+		pr_err("Status: %d\n", status);
 		return;
 	}
 
 	if (report != 2) {
-		pr_err("Unexpected report %d", report);
+		pr_err("Unexpected report %d\n", report);
 		return;
 	}
 
@@ -361,7 +361,7 @@ static void sdp_rx_data_complete(struct usb_ep
 *ep, struct usb_request *req) sdp->state = SDP_STATE_TX_SEC_CONF;
 		break;
 	default:
-		pr_err("Invalid state: %d", sdp->state);
+		pr_err("Invalid state: %d\n", sdp->state);
 	}
 }
 
@@ -371,7 +371,7 @@ static void sdp_tx_complete(struct usb_ep *ep,
 struct usb_request *req) int status = req->status;
 
 	if (status != 0) {
-		pr_err("Status: %d", status);
+		pr_err("Status: %d\n", status);
 		return;
 	}
 

drivers/usb/gadget/f_sdp.c static void sdp_tx_complete(struct usb_ep *ep, · line 400

Quoted 8 lines
drivers/usb/gadget/f_sdp.c +1 -1
@@ -394,7 +394,7 @@ static void sdp_tx_complete(struct usb_ep *ep,
 struct usb_request *req) sdp->state = SDP_STATE_IDLE;
 		break;
 	default:
-		pr_err("Wrong State: %d", sdp->state);
+		pr_err("Wrong State: %d\n", sdp->state);
 		sdp->state = SDP_STATE_IDLE;
 		break;
 	}

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de