diff options
Diffstat (limited to 'drivers/usb/serial/io_edgeport.c')
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 9c79fb22f341..0dd8cce9c9d3 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -898,7 +898,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
898 | edge_port->txfifo.fifo = kmalloc(edge_port->maxTxCredits, GFP_KERNEL); | 898 | edge_port->txfifo.fifo = kmalloc(edge_port->maxTxCredits, GFP_KERNEL); |
899 | 899 | ||
900 | if (!edge_port->txfifo.fifo) { | 900 | if (!edge_port->txfifo.fifo) { |
901 | dev_dbg(dev, "%s - no memory\n", __func__); | ||
902 | edge_close(port); | 901 | edge_close(port); |
903 | return -ENOMEM; | 902 | return -ENOMEM; |
904 | } | 903 | } |
@@ -908,7 +907,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
908 | edge_port->write_in_progress = false; | 907 | edge_port->write_in_progress = false; |
909 | 908 | ||
910 | if (!edge_port->write_urb) { | 909 | if (!edge_port->write_urb) { |
911 | dev_dbg(dev, "%s - no memory\n", __func__); | ||
912 | edge_close(port); | 910 | edge_close(port); |
913 | return -ENOMEM; | 911 | return -ENOMEM; |
914 | } | 912 | } |
@@ -1245,9 +1243,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, | |||
1245 | to send out */ | 1243 | to send out */ |
1246 | count = fifo->count; | 1244 | count = fifo->count; |
1247 | buffer = kmalloc(count+2, GFP_ATOMIC); | 1245 | buffer = kmalloc(count+2, GFP_ATOMIC); |
1248 | if (buffer == NULL) { | 1246 | if (!buffer) { |
1249 | dev_err_console(edge_port->port, | ||
1250 | "%s - no more kernel memory...\n", __func__); | ||
1251 | edge_port->write_in_progress = false; | 1247 | edge_port->write_in_progress = false; |
1252 | goto exit_send; | 1248 | goto exit_send; |
1253 | } | 1249 | } |
@@ -2025,11 +2021,8 @@ static int sram_write(struct usb_serial *serial, __u16 extAddr, __u16 addr, | |||
2025 | dev_dbg(&serial->dev->dev, "%s - %x, %x, %d\n", __func__, extAddr, addr, length); | 2021 | dev_dbg(&serial->dev->dev, "%s - %x, %x, %d\n", __func__, extAddr, addr, length); |
2026 | 2022 | ||
2027 | transfer_buffer = kmalloc(64, GFP_KERNEL); | 2023 | transfer_buffer = kmalloc(64, GFP_KERNEL); |
2028 | if (!transfer_buffer) { | 2024 | if (!transfer_buffer) |
2029 | dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", | ||
2030 | __func__, 64); | ||
2031 | return -ENOMEM; | 2025 | return -ENOMEM; |
2032 | } | ||
2033 | 2026 | ||
2034 | /* need to split these writes up into 64 byte chunks */ | 2027 | /* need to split these writes up into 64 byte chunks */ |
2035 | result = 0; | 2028 | result = 0; |
@@ -2073,11 +2066,8 @@ static int rom_write(struct usb_serial *serial, __u16 extAddr, __u16 addr, | |||
2073 | unsigned char *transfer_buffer; | 2066 | unsigned char *transfer_buffer; |
2074 | 2067 | ||
2075 | transfer_buffer = kmalloc(64, GFP_KERNEL); | 2068 | transfer_buffer = kmalloc(64, GFP_KERNEL); |
2076 | if (!transfer_buffer) { | 2069 | if (!transfer_buffer) |
2077 | dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", | ||
2078 | __func__, 64); | ||
2079 | return -ENOMEM; | 2070 | return -ENOMEM; |
2080 | } | ||
2081 | 2071 | ||
2082 | /* need to split these writes up into 64 byte chunks */ | 2072 | /* need to split these writes up into 64 byte chunks */ |
2083 | result = 0; | 2073 | result = 0; |
@@ -2119,11 +2109,8 @@ static int rom_read(struct usb_serial *serial, __u16 extAddr, | |||
2119 | unsigned char *transfer_buffer; | 2109 | unsigned char *transfer_buffer; |
2120 | 2110 | ||
2121 | transfer_buffer = kmalloc(64, GFP_KERNEL); | 2111 | transfer_buffer = kmalloc(64, GFP_KERNEL); |
2122 | if (!transfer_buffer) { | 2112 | if (!transfer_buffer) |
2123 | dev_err(&serial->dev->dev, | ||
2124 | "%s - kmalloc(%d) failed.\n", __func__, 64); | ||
2125 | return -ENOMEM; | 2113 | return -ENOMEM; |
2126 | } | ||
2127 | 2114 | ||
2128 | /* need to split these reads up into 64 byte chunks */ | 2115 | /* need to split these reads up into 64 byte chunks */ |
2129 | result = 0; | 2116 | result = 0; |
@@ -2163,11 +2150,8 @@ static int send_iosp_ext_cmd(struct edgeport_port *edge_port, | |||
2163 | int status = 0; | 2150 | int status = 0; |
2164 | 2151 | ||
2165 | buffer = kmalloc(10, GFP_ATOMIC); | 2152 | buffer = kmalloc(10, GFP_ATOMIC); |
2166 | if (!buffer) { | 2153 | if (!buffer) |
2167 | dev_err(&edge_port->port->dev, | ||
2168 | "%s - kmalloc(%d) failed.\n", __func__, 10); | ||
2169 | return -ENOMEM; | 2154 | return -ENOMEM; |
2170 | } | ||
2171 | 2155 | ||
2172 | currentCommand = buffer; | 2156 | currentCommand = buffer; |
2173 | 2157 | ||
@@ -2274,10 +2258,9 @@ static int send_cmd_write_baud_rate(struct edgeport_port *edge_port, | |||
2274 | 2258 | ||
2275 | /* Alloc memory for the string of commands. */ | 2259 | /* Alloc memory for the string of commands. */ |
2276 | cmdBuffer = kmalloc(0x100, GFP_ATOMIC); | 2260 | cmdBuffer = kmalloc(0x100, GFP_ATOMIC); |
2277 | if (!cmdBuffer) { | 2261 | if (!cmdBuffer) |
2278 | dev_err(dev, "%s - kmalloc(%d) failed.\n", __func__, 0x100); | ||
2279 | return -ENOMEM; | 2262 | return -ENOMEM; |
2280 | } | 2263 | |
2281 | currCmd = cmdBuffer; | 2264 | currCmd = cmdBuffer; |
2282 | 2265 | ||
2283 | /* Enable access to divisor latch */ | 2266 | /* Enable access to divisor latch */ |
@@ -2783,10 +2766,9 @@ static int edge_startup(struct usb_serial *serial) | |||
2783 | 2766 | ||
2784 | /* create our private serial structure */ | 2767 | /* create our private serial structure */ |
2785 | edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); | 2768 | edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); |
2786 | if (edge_serial == NULL) { | 2769 | if (!edge_serial) |
2787 | dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__); | ||
2788 | return -ENOMEM; | 2770 | return -ENOMEM; |
2789 | } | 2771 | |
2790 | spin_lock_init(&edge_serial->es_lock); | 2772 | spin_lock_init(&edge_serial->es_lock); |
2791 | edge_serial->serial = serial; | 2773 | edge_serial->serial = serial; |
2792 | usb_set_serial_data(serial, edge_serial); | 2774 | usb_set_serial_data(serial, edge_serial); |
@@ -2875,14 +2857,12 @@ static int edge_startup(struct usb_serial *serial) | |||
2875 | /* not set up yet, so do it now */ | 2857 | /* not set up yet, so do it now */ |
2876 | edge_serial->interrupt_read_urb = | 2858 | edge_serial->interrupt_read_urb = |
2877 | usb_alloc_urb(0, GFP_KERNEL); | 2859 | usb_alloc_urb(0, GFP_KERNEL); |
2878 | if (!edge_serial->interrupt_read_urb) { | 2860 | if (!edge_serial->interrupt_read_urb) |
2879 | dev_err(ddev, "out of memory\n"); | ||
2880 | return -ENOMEM; | 2861 | return -ENOMEM; |
2881 | } | 2862 | |
2882 | edge_serial->interrupt_in_buffer = | 2863 | edge_serial->interrupt_in_buffer = |
2883 | kmalloc(buffer_size, GFP_KERNEL); | 2864 | kmalloc(buffer_size, GFP_KERNEL); |
2884 | if (!edge_serial->interrupt_in_buffer) { | 2865 | if (!edge_serial->interrupt_in_buffer) { |
2885 | dev_err(ddev, "out of memory\n"); | ||
2886 | usb_free_urb(edge_serial->interrupt_read_urb); | 2866 | usb_free_urb(edge_serial->interrupt_read_urb); |
2887 | return -ENOMEM; | 2867 | return -ENOMEM; |
2888 | } | 2868 | } |
@@ -2912,14 +2892,12 @@ static int edge_startup(struct usb_serial *serial) | |||
2912 | /* not set up yet, so do it now */ | 2892 | /* not set up yet, so do it now */ |
2913 | edge_serial->read_urb = | 2893 | edge_serial->read_urb = |
2914 | usb_alloc_urb(0, GFP_KERNEL); | 2894 | usb_alloc_urb(0, GFP_KERNEL); |
2915 | if (!edge_serial->read_urb) { | 2895 | if (!edge_serial->read_urb) |
2916 | dev_err(ddev, "out of memory\n"); | ||
2917 | return -ENOMEM; | 2896 | return -ENOMEM; |
2918 | } | 2897 | |
2919 | edge_serial->bulk_in_buffer = | 2898 | edge_serial->bulk_in_buffer = |
2920 | kmalloc(buffer_size, GFP_KERNEL); | 2899 | kmalloc(buffer_size, GFP_KERNEL); |
2921 | if (!edge_serial->bulk_in_buffer) { | 2900 | if (!edge_serial->bulk_in_buffer) { |
2922 | dev_err(&dev->dev, "out of memory\n"); | ||
2923 | usb_free_urb(edge_serial->read_urb); | 2901 | usb_free_urb(edge_serial->read_urb); |
2924 | return -ENOMEM; | 2902 | return -ENOMEM; |
2925 | } | 2903 | } |