Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1296859

[PATCH v2 1/2] USB-FHCI: Use a signed return type for fhci_create_ep()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH v2 1/2] USB-FHCI: Use a signed return type for fhci_create_ep()
Date 2015-12-22 17:00 +0100
Message-ID <qIxvX-5Qb-3@gated-at.bofh.it> (permalink)
References <qHw8W-7P7-19@gated-at.bofh.it> <qHwiC-7SO-7@gated-at.bofh.it> <qIxmi-5MK-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 22 Dec 2015 16:10:14 +0100

The return type "u32" was used by the fhci_create_ep() function even though
it will eventually return a negative error code.
Improve this implementation detail by using the type "int" instead.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/usb/host/fhci-tds.c | 2 +-
 drivers/usb/host/fhci.h     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/fhci-tds.c b/drivers/usb/host/fhci-tds.c
index f82ad5d..fc0b525 100644
--- a/drivers/usb/host/fhci-tds.c
+++ b/drivers/usb/host/fhci-tds.c
@@ -149,7 +149,7 @@ void fhci_ep0_free(struct fhci_usb *usb)
  * data_mem	The data memory partition(BUS)
  * ring_len	TD ring length
  */
-u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem,
+int fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem,
 			   u32 ring_len)
 {
 	struct endpoint *ep;
diff --git a/drivers/usb/host/fhci.h b/drivers/usb/host/fhci.h
index 154e6a0..afa3cfc 100644
--- a/drivers/usb/host/fhci.h
+++ b/drivers/usb/host/fhci.h
@@ -547,7 +547,7 @@ u32 fhci_host_transaction(struct fhci_usb *usb, struct packet *pkt,
 void fhci_host_transmit_actual_frame(struct fhci_usb *usb);
 void fhci_tx_conf_interrupt(struct fhci_usb *usb);
 void fhci_push_dummy_bd(struct endpoint *ep);
-u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem,
+int fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem,
 		   u32 ring_len);
 void fhci_init_ep_registers(struct fhci_usb *usb,
 			    struct endpoint *ep,
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] USB-FHCI: Use a signed return type for fhci_create_ep() SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-19 21:20 +0100
  Re: [PATCH] USB-FHCI: Use a signed return type for fhci_create_ep() Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-19 21:30 +0100
    Re: [PATCH] USB-FHCI: Use a signed return type for fhci_create_ep() SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-19 22:00 +0100
      Re: [PATCH] USB-FHCI: Use a signed return type for fhci_create_ep() Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-19 22:10 +0100
    [PATCH v2 0/2] USB-FHCI: Use return type "int" for two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-22 16:50 +0100
      [PATCH v2 1/2] USB-FHCI: Use a signed return type for  fhci_create_ep() SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-22 17:00 +0100
      [PATCH v2 2/2] USB-FHCI: Use a signed return type for  endpoint_zero_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-22 17:00 +0100
  Re: [PATCH] USB-FHCI: Use a signed return type for fhci_create_ep() Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-12-19 21:50 +0100

csiph-web