aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/agp/frontend.c1
-rw-r--r--drivers/char/agp/intel-gtt.c23
-rw-r--r--drivers/char/amiserial.c2
-rw-r--r--drivers/char/briq_panel.c1
-rw-r--r--drivers/char/hpet.c1
-rw-r--r--drivers/char/hw_random/core.c1
-rw-r--r--drivers/char/i8k.c7
-rw-r--r--drivers/char/istallion.c1
-rw-r--r--drivers/char/nozomi.c1
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c3
-rw-r--r--drivers/char/pcmcia/synclink_cs.c1
-rw-r--r--drivers/char/ramoops.c12
-rw-r--r--drivers/char/serial167.c1
-rw-r--r--drivers/char/specialix.c1
-rw-r--r--drivers/char/stallion.c1
-rw-r--r--drivers/char/sx.c1
-rw-r--r--drivers/char/tpm/tpm_tis.c24
-rw-r--r--drivers/char/uv_mmtimer.c1
-rw-r--r--drivers/char/virtio_console.c37
19 files changed, 63 insertions, 57 deletions
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index 43412c03969e..3cb4539a98b2 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -39,7 +39,6 @@
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/fs.h> 40#include <linux/fs.h>
41#include <linux/sched.h> 41#include <linux/sched.h>
42#include <linux/smp_lock.h>
43#include <asm/uaccess.h> 42#include <asm/uaccess.h>
44#include <asm/pgtable.h> 43#include <asm/pgtable.h>
45#include "agp.h" 44#include "agp.h"
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 6b6760ea2435..29ac6d499fa6 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -812,8 +812,10 @@ static int intel_fake_agp_fetch_size(void)
812 812
813static void i830_cleanup(void) 813static void i830_cleanup(void)
814{ 814{
815 kunmap(intel_private.i8xx_page); 815 if (intel_private.i8xx_flush_page) {
816 intel_private.i8xx_flush_page = NULL; 816 kunmap(intel_private.i8xx_flush_page);
817 intel_private.i8xx_flush_page = NULL;
818 }
817 819
818 __free_page(intel_private.i8xx_page); 820 __free_page(intel_private.i8xx_page);
819 intel_private.i8xx_page = NULL; 821 intel_private.i8xx_page = NULL;
@@ -1190,12 +1192,19 @@ static void i9xx_chipset_flush(void)
1190 writel(1, intel_private.i9xx_flush_page); 1192 writel(1, intel_private.i9xx_flush_page);
1191} 1193}
1192 1194
1193static void i965_write_entry(dma_addr_t addr, unsigned int entry, 1195static void i965_write_entry(dma_addr_t addr,
1196 unsigned int entry,
1194 unsigned int flags) 1197 unsigned int flags)
1195{ 1198{
1199 u32 pte_flags;
1200
1201 pte_flags = I810_PTE_VALID;
1202 if (flags == AGP_USER_CACHED_MEMORY)
1203 pte_flags |= I830_PTE_SYSTEM_CACHED;
1204
1196 /* Shift high bits down */ 1205 /* Shift high bits down */
1197 addr |= (addr >> 28) & 0xf0; 1206 addr |= (addr >> 28) & 0xf0;
1198 writel(addr | I810_PTE_VALID, intel_private.gtt + entry); 1207 writel(addr | pte_flags, intel_private.gtt + entry);
1199} 1208}
1200 1209
1201static bool gen6_check_flags(unsigned int flags) 1210static bool gen6_check_flags(unsigned int flags)
@@ -1210,14 +1219,14 @@ static void gen6_write_entry(dma_addr_t addr, unsigned int entry,
1210 unsigned int gfdt = flags & AGP_USER_CACHED_MEMORY_GFDT; 1219 unsigned int gfdt = flags & AGP_USER_CACHED_MEMORY_GFDT;
1211 u32 pte_flags; 1220 u32 pte_flags;
1212 1221
1213 if (type_mask == AGP_USER_UNCACHED_MEMORY) 1222 if (type_mask == AGP_USER_MEMORY)
1214 pte_flags = GEN6_PTE_UNCACHED | I810_PTE_VALID; 1223 pte_flags = GEN6_PTE_UNCACHED | I810_PTE_VALID;
1215 else if (type_mask == AGP_USER_CACHED_MEMORY_LLC_MLC) { 1224 else if (type_mask == AGP_USER_CACHED_MEMORY_LLC_MLC) {
1216 pte_flags = GEN6_PTE_LLC | I810_PTE_VALID; 1225 pte_flags = GEN6_PTE_LLC_MLC | I810_PTE_VALID;
1217 if (gfdt) 1226 if (gfdt)
1218 pte_flags |= GEN6_PTE_GFDT; 1227 pte_flags |= GEN6_PTE_GFDT;
1219 } else { /* set 'normal'/'cached' to LLC by default */ 1228 } else { /* set 'normal'/'cached' to LLC by default */
1220 pte_flags = GEN6_PTE_LLC_MLC | I810_PTE_VALID; 1229 pte_flags = GEN6_PTE_LLC | I810_PTE_VALID;
1221 if (gfdt) 1230 if (gfdt)
1222 pte_flags |= GEN6_PTE_GFDT; 1231 pte_flags |= GEN6_PTE_GFDT;
1223 } 1232 }
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
index b0a70461a12c..6ee3348bc3e4 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/char/amiserial.c
@@ -81,7 +81,6 @@ static char *serial_version = "4.30";
81#include <linux/mm.h> 81#include <linux/mm.h>
82#include <linux/seq_file.h> 82#include <linux/seq_file.h>
83#include <linux/slab.h> 83#include <linux/slab.h>
84#include <linux/smp_lock.h>
85#include <linux/init.h> 84#include <linux/init.h>
86#include <linux/bitops.h> 85#include <linux/bitops.h>
87#include <linux/platform_device.h> 86#include <linux/platform_device.h>
@@ -1299,7 +1298,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
1299{ 1298{
1300 struct async_struct * info = tty->driver_data; 1299 struct async_struct * info = tty->driver_data;
1301 struct async_icount cprev, cnow; /* kernel counter temps */ 1300 struct async_icount cprev, cnow; /* kernel counter temps */
1302 struct serial_icounter_struct icount;
1303 void __user *argp = (void __user *)arg; 1301 void __user *argp = (void __user *)arg;
1304 unsigned long flags; 1302 unsigned long flags;
1305 1303
diff --git a/drivers/char/briq_panel.c b/drivers/char/briq_panel.c
index f6718f05dad4..095ab90535ce 100644
--- a/drivers/char/briq_panel.c
+++ b/drivers/char/briq_panel.c
@@ -6,7 +6,6 @@
6 6
7#include <linux/module.h> 7#include <linux/module.h>
8 8
9#include <linux/smp_lock.h>
10#include <linux/types.h> 9#include <linux/types.h>
11#include <linux/errno.h> 10#include <linux/errno.h>
12#include <linux/tty.h> 11#include <linux/tty.h>
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 55b8667f739f..7066e801b9d3 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -14,7 +14,6 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/smp_lock.h>
18#include <linux/types.h> 17#include <linux/types.h>
19#include <linux/miscdevice.h> 18#include <linux/miscdevice.h>
20#include <linux/major.h> 19#include <linux/major.h>
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 788da05190cc..2016aad85203 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -37,7 +37,6 @@
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/fs.h> 38#include <linux/fs.h>
39#include <linux/sched.h> 39#include <linux/sched.h>
40#include <linux/smp_lock.h>
41#include <linux/init.h> 40#include <linux/init.h>
42#include <linux/miscdevice.h> 41#include <linux/miscdevice.h>
43#include <linux/delay.h> 42#include <linux/delay.h>
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
index 3bc0eef88717..d72433f2d310 100644
--- a/drivers/char/i8k.c
+++ b/drivers/char/i8k.c
@@ -120,7 +120,7 @@ static int i8k_smm(struct smm_regs *regs)
120 int eax = regs->eax; 120 int eax = regs->eax;
121 121
122#if defined(CONFIG_X86_64) 122#if defined(CONFIG_X86_64)
123 asm("pushq %%rax\n\t" 123 asm volatile("pushq %%rax\n\t"
124 "movl 0(%%rax),%%edx\n\t" 124 "movl 0(%%rax),%%edx\n\t"
125 "pushq %%rdx\n\t" 125 "pushq %%rdx\n\t"
126 "movl 4(%%rax),%%ebx\n\t" 126 "movl 4(%%rax),%%ebx\n\t"
@@ -146,7 +146,7 @@ static int i8k_smm(struct smm_regs *regs)
146 : "a"(regs) 146 : "a"(regs)
147 : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); 147 : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
148#else 148#else
149 asm("pushl %%eax\n\t" 149 asm volatile("pushl %%eax\n\t"
150 "movl 0(%%eax),%%edx\n\t" 150 "movl 0(%%eax),%%edx\n\t"
151 "push %%edx\n\t" 151 "push %%edx\n\t"
152 "movl 4(%%eax),%%ebx\n\t" 152 "movl 4(%%eax),%%ebx\n\t"
@@ -167,7 +167,8 @@ static int i8k_smm(struct smm_regs *regs)
167 "movl %%edx,0(%%eax)\n\t" 167 "movl %%edx,0(%%eax)\n\t"
168 "lahf\n\t" 168 "lahf\n\t"
169 "shrl $8,%%eax\n\t" 169 "shrl $8,%%eax\n\t"
170 "andl $1,%%eax\n":"=a"(rc) 170 "andl $1,%%eax\n"
171 :"=a"(rc)
171 : "a"(regs) 172 : "a"(regs)
172 : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); 173 : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
173#endif 174#endif
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 667abd23ad6a..7c6de4c92458 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -21,7 +21,6 @@
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/smp_lock.h>
25#include <linux/interrupt.h> 24#include <linux/interrupt.h>
26#include <linux/tty.h> 25#include <linux/tty.h>
27#include <linux/tty_flip.h> 26#include <linux/tty_flip.h>
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
index dd3f9b1f11b4..294d03e8c61a 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/char/nozomi.c
@@ -1828,7 +1828,6 @@ static int ntty_ioctl(struct tty_struct *tty, struct file *file,
1828 unsigned int cmd, unsigned long arg) 1828 unsigned int cmd, unsigned long arg)
1829{ 1829{
1830 struct port *port = tty->driver_data; 1830 struct port *port = tty->driver_data;
1831 void __user *argp = (void __user *)arg;
1832 int rval = -ENOIOCTLCMD; 1831 int rval = -ENOIOCTLCMD;
1833 1832
1834 DBG1("******** IOCTL, cmd: %d", cmd); 1833 DBG1("******** IOCTL, cmd: %d", cmd);
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index d962f25dcc2a..777181a2e603 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -979,8 +979,9 @@ static ssize_t cmm_read(struct file *filp, __user char *buf, size_t count,
979 if (dev->flags0 & 1) { 979 if (dev->flags0 & 1) {
980 set_bit(IS_CMM_ABSENT, &dev->flags); 980 set_bit(IS_CMM_ABSENT, &dev->flags);
981 rc = -ENODEV; 981 rc = -ENODEV;
982 } else {
983 rc = -EIO;
982 } 984 }
983 rc = -EIO;
984 goto release_io; 985 goto release_io;
985 } 986 }
986 987
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index bfc10f89d951..eaa41992fbe2 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -2796,6 +2796,7 @@ static const struct tty_operations mgslpc_ops = {
2796 .hangup = mgslpc_hangup, 2796 .hangup = mgslpc_hangup,
2797 .tiocmget = tiocmget, 2797 .tiocmget = tiocmget,
2798 .tiocmset = tiocmset, 2798 .tiocmset = tiocmset,
2799 .get_icount = mgslpc_get_icount,
2799 .proc_fops = &mgslpc_proc_fops, 2800 .proc_fops = &mgslpc_proc_fops,
2800}; 2801};
2801 2802
diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
index 73dcb0ee41fd..d3d63be2cd37 100644
--- a/drivers/char/ramoops.c
+++ b/drivers/char/ramoops.c
@@ -29,7 +29,6 @@
29#include <linux/ramoops.h> 29#include <linux/ramoops.h>
30 30
31#define RAMOOPS_KERNMSG_HDR "====" 31#define RAMOOPS_KERNMSG_HDR "===="
32#define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval))
33 32
34#define RECORD_SIZE 4096 33#define RECORD_SIZE 4096
35 34
@@ -65,8 +64,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
65 struct ramoops_context, dump); 64 struct ramoops_context, dump);
66 unsigned long s1_start, s2_start; 65 unsigned long s1_start, s2_start;
67 unsigned long l1_cpy, l2_cpy; 66 unsigned long l1_cpy, l2_cpy;
68 int res; 67 int res, hdr_size;
69 char *buf; 68 char *buf, *buf_orig;
70 struct timeval timestamp; 69 struct timeval timestamp;
71 70
72 /* Only dump oopses if dump_oops is set */ 71 /* Only dump oopses if dump_oops is set */
@@ -74,6 +73,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
74 return; 73 return;
75 74
76 buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); 75 buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE));
76 buf_orig = buf;
77
77 memset(buf, '\0', RECORD_SIZE); 78 memset(buf, '\0', RECORD_SIZE);
78 res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); 79 res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR);
79 buf += res; 80 buf += res;
@@ -81,8 +82,9 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
81 res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); 82 res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec);
82 buf += res; 83 buf += res;
83 84
84 l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE)); 85 hdr_size = buf - buf_orig;
85 l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE) - l2_cpy); 86 l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - hdr_size));
87 l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - hdr_size) - l2_cpy);
86 88
87 s2_start = l2 - l2_cpy; 89 s2_start = l2 - l2_cpy;
88 s1_start = l1 - l1_cpy; 90 s1_start = l1 - l1_cpy;
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c
index f646725bd567..748c3b0ecd89 100644
--- a/drivers/char/serial167.c
+++ b/drivers/char/serial167.c
@@ -52,7 +52,6 @@
52#include <linux/interrupt.h> 52#include <linux/interrupt.h>
53#include <linux/serial.h> 53#include <linux/serial.h>
54#include <linux/serialP.h> 54#include <linux/serialP.h>
55#include <linux/smp_lock.h>
56#include <linux/string.h> 55#include <linux/string.h>
57#include <linux/fcntl.h> 56#include <linux/fcntl.h>
58#include <linux/ptrace.h> 57#include <linux/ptrace.h>
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index 9f8495b4fc8f..a7616d226a49 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -87,7 +87,6 @@
87#include <linux/tty_flip.h> 87#include <linux/tty_flip.h>
88#include <linux/mm.h> 88#include <linux/mm.h>
89#include <linux/serial.h> 89#include <linux/serial.h>
90#include <linux/smp_lock.h>
91#include <linux/fcntl.h> 90#include <linux/fcntl.h>
92#include <linux/major.h> 91#include <linux/major.h>
93#include <linux/delay.h> 92#include <linux/delay.h>
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 4bef6ab83622..461a5a045517 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -40,7 +40,6 @@
40#include <linux/stallion.h> 40#include <linux/stallion.h>
41#include <linux/ioport.h> 41#include <linux/ioport.h>
42#include <linux/init.h> 42#include <linux/init.h>
43#include <linux/smp_lock.h>
44#include <linux/device.h> 43#include <linux/device.h>
45#include <linux/delay.h> 44#include <linux/delay.h>
46#include <linux/ctype.h> 45#include <linux/ctype.h>
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index e53f16865397..a786326cea2f 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -216,7 +216,6 @@
216#include <linux/eisa.h> 216#include <linux/eisa.h>
217#include <linux/pci.h> 217#include <linux/pci.h>
218#include <linux/slab.h> 218#include <linux/slab.h>
219#include <linux/smp_lock.h>
220#include <linux/init.h> 219#include <linux/init.h>
221#include <linux/miscdevice.h> 220#include <linux/miscdevice.h>
222#include <linux/bitops.h> 221#include <linux/bitops.h>
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 1030f8420137..c17a305ecb28 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -25,6 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <linux/acpi.h>
28#include "tpm.h" 29#include "tpm.h"
29 30
30#define TPM_HEADER_SIZE 10 31#define TPM_HEADER_SIZE 10
@@ -78,6 +79,26 @@ enum tis_defaults {
78static LIST_HEAD(tis_chips); 79static LIST_HEAD(tis_chips);
79static DEFINE_SPINLOCK(tis_lock); 80static DEFINE_SPINLOCK(tis_lock);
80 81
82#ifdef CONFIG_ACPI
83static int is_itpm(struct pnp_dev *dev)
84{
85 struct acpi_device *acpi = pnp_acpi_device(dev);
86 struct acpi_hardware_id *id;
87
88 list_for_each_entry(id, &acpi->pnp.ids, list) {
89 if (!strcmp("INTC0102", id->id))
90 return 1;
91 }
92
93 return 0;
94}
95#else
96static int is_itpm(struct pnp_dev *dev)
97{
98 return 0;
99}
100#endif
101
81static int check_locality(struct tpm_chip *chip, int l) 102static int check_locality(struct tpm_chip *chip, int l)
82{ 103{
83 if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & 104 if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
@@ -472,6 +493,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
472 "1.2 TPM (device-id 0x%X, rev-id %d)\n", 493 "1.2 TPM (device-id 0x%X, rev-id %d)\n",
473 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); 494 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
474 495
496 if (is_itpm(to_pnp_dev(dev)))
497 itpm = 1;
498
475 if (itpm) 499 if (itpm)
476 dev_info(dev, "Intel iTPM workaround enabled\n"); 500 dev_info(dev, "Intel iTPM workaround enabled\n");
477 501
diff --git a/drivers/char/uv_mmtimer.c b/drivers/char/uv_mmtimer.c
index 493b47a0d511..956ebe2080a5 100644
--- a/drivers/char/uv_mmtimer.c
+++ b/drivers/char/uv_mmtimer.c
@@ -23,7 +23,6 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/time.h> 24#include <linux/time.h>
25#include <linux/math64.h> 25#include <linux/math64.h>
26#include <linux/smp_lock.h>
27 26
28#include <asm/genapic.h> 27#include <asm/genapic.h>
29#include <asm/uv/uv_hub.h> 28#include <asm/uv/uv_hub.h>
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 6c1b676643a9..896a2ced1d27 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1547,31 +1547,16 @@ static int init_vqs(struct ports_device *portdev)
1547 nr_queues = use_multiport(portdev) ? (nr_ports + 1) * 2 : 2; 1547 nr_queues = use_multiport(portdev) ? (nr_ports + 1) * 2 : 2;
1548 1548
1549 vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL); 1549 vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL);
1550 if (!vqs) {
1551 err = -ENOMEM;
1552 goto fail;
1553 }
1554 io_callbacks = kmalloc(nr_queues * sizeof(vq_callback_t *), GFP_KERNEL); 1550 io_callbacks = kmalloc(nr_queues * sizeof(vq_callback_t *), GFP_KERNEL);
1555 if (!io_callbacks) {
1556 err = -ENOMEM;
1557 goto free_vqs;
1558 }
1559 io_names = kmalloc(nr_queues * sizeof(char *), GFP_KERNEL); 1551 io_names = kmalloc(nr_queues * sizeof(char *), GFP_KERNEL);
1560 if (!io_names) {
1561 err = -ENOMEM;
1562 goto free_callbacks;
1563 }
1564 portdev->in_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *), 1552 portdev->in_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *),
1565 GFP_KERNEL); 1553 GFP_KERNEL);
1566 if (!portdev->in_vqs) {
1567 err = -ENOMEM;
1568 goto free_names;
1569 }
1570 portdev->out_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *), 1554 portdev->out_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *),
1571 GFP_KERNEL); 1555 GFP_KERNEL);
1572 if (!portdev->out_vqs) { 1556 if (!vqs || !io_callbacks || !io_names || !portdev->in_vqs ||
1557 !portdev->out_vqs) {
1573 err = -ENOMEM; 1558 err = -ENOMEM;
1574 goto free_invqs; 1559 goto free;
1575 } 1560 }
1576 1561
1577 /* 1562 /*
@@ -1605,7 +1590,7 @@ static int init_vqs(struct ports_device *portdev)
1605 io_callbacks, 1590 io_callbacks,
1606 (const char **)io_names); 1591 (const char **)io_names);
1607 if (err) 1592 if (err)
1608 goto free_outvqs; 1593 goto free;
1609 1594
1610 j = 0; 1595 j = 0;
1611 portdev->in_vqs[0] = vqs[0]; 1596 portdev->in_vqs[0] = vqs[0];
@@ -1621,23 +1606,19 @@ static int init_vqs(struct ports_device *portdev)
1621 portdev->out_vqs[i] = vqs[j + 1]; 1606 portdev->out_vqs[i] = vqs[j + 1];
1622 } 1607 }
1623 } 1608 }
1624 kfree(io_callbacks);
1625 kfree(io_names); 1609 kfree(io_names);
1610 kfree(io_callbacks);
1626 kfree(vqs); 1611 kfree(vqs);
1627 1612
1628 return 0; 1613 return 0;
1629 1614
1630free_names: 1615free:
1631 kfree(io_names);
1632free_callbacks:
1633 kfree(io_callbacks);
1634free_outvqs:
1635 kfree(portdev->out_vqs); 1616 kfree(portdev->out_vqs);
1636free_invqs:
1637 kfree(portdev->in_vqs); 1617 kfree(portdev->in_vqs);
1638free_vqs: 1618 kfree(io_names);
1619 kfree(io_callbacks);
1639 kfree(vqs); 1620 kfree(vqs);
1640fail: 1621
1641 return err; 1622 return err;
1642} 1623}
1643 1624