aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/qib/qib_diag.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_diag.c')
-rw-r--r--drivers/infiniband/hw/qib/qib_diag.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/qib/qib_diag.c b/drivers/infiniband/hw/qib/qib_diag.c
index 5dfda4c5cc9c..8c34b23e5bf6 100644
--- a/drivers/infiniband/hw/qib/qib_diag.c
+++ b/drivers/infiniband/hw/qib/qib_diag.c
@@ -85,7 +85,7 @@ static struct qib_diag_client *get_client(struct qib_devdata *dd)
85 client_pool = dc->next; 85 client_pool = dc->next;
86 else 86 else
87 /* None in pool, alloc and init */ 87 /* None in pool, alloc and init */
88 dc = kmalloc(sizeof *dc, GFP_KERNEL); 88 dc = kmalloc(sizeof(*dc), GFP_KERNEL);
89 89
90 if (dc) { 90 if (dc) {
91 dc->next = NULL; 91 dc->next = NULL;
@@ -257,6 +257,7 @@ static u32 __iomem *qib_remap_ioaddr32(struct qib_devdata *dd, u32 offset,
257 if (dd->userbase) { 257 if (dd->userbase) {
258 /* If user regs mapped, they are after send, so set limit. */ 258 /* If user regs mapped, they are after send, so set limit. */
259 u32 ulim = (dd->cfgctxts * dd->ureg_align) + dd->uregbase; 259 u32 ulim = (dd->cfgctxts * dd->ureg_align) + dd->uregbase;
260
260 if (!dd->piovl15base) 261 if (!dd->piovl15base)
261 snd_lim = dd->uregbase; 262 snd_lim = dd->uregbase;
262 krb32 = (u32 __iomem *)dd->userbase; 263 krb32 = (u32 __iomem *)dd->userbase;
@@ -280,6 +281,7 @@ static u32 __iomem *qib_remap_ioaddr32(struct qib_devdata *dd, u32 offset,
280 snd_bottom = dd->pio2k_bufbase; 281 snd_bottom = dd->pio2k_bufbase;
281 if (snd_lim == 0) { 282 if (snd_lim == 0) {
282 u32 tot2k = dd->piobcnt2k * ALIGN(dd->piosize2k, dd->palign); 283 u32 tot2k = dd->piobcnt2k * ALIGN(dd->piosize2k, dd->palign);
284
283 snd_lim = snd_bottom + tot2k; 285 snd_lim = snd_bottom + tot2k;
284 } 286 }
285 /* If 4k buffers exist, account for them by bumping 287 /* If 4k buffers exist, account for them by bumping
@@ -398,6 +400,7 @@ static int qib_write_umem64(struct qib_devdata *dd, u32 regoffs,
398 /* not very efficient, but it works for now */ 400 /* not very efficient, but it works for now */
399 while (reg_addr < reg_end) { 401 while (reg_addr < reg_end) {
400 u64 data; 402 u64 data;
403
401 if (copy_from_user(&data, uaddr, sizeof(data))) { 404 if (copy_from_user(&data, uaddr, sizeof(data))) {
402 ret = -EFAULT; 405 ret = -EFAULT;
403 goto bail; 406 goto bail;
@@ -698,7 +701,7 @@ int qib_register_observer(struct qib_devdata *dd,
698 701
699 if (!dd || !op) 702 if (!dd || !op)
700 return -EINVAL; 703 return -EINVAL;
701 olp = vmalloc(sizeof *olp); 704 olp = vmalloc(sizeof(*olp));
702 if (!olp) { 705 if (!olp) {
703 pr_err("vmalloc for observer failed\n"); 706 pr_err("vmalloc for observer failed\n");
704 return -ENOMEM; 707 return -ENOMEM;
@@ -796,6 +799,7 @@ static ssize_t qib_diag_read(struct file *fp, char __user *data,
796 op = diag_get_observer(dd, *off); 799 op = diag_get_observer(dd, *off);
797 if (op) { 800 if (op) {
798 u32 offset = *off; 801 u32 offset = *off;
802
799 ret = op->hook(dd, op, offset, &data64, 0, use_32); 803 ret = op->hook(dd, op, offset, &data64, 0, use_32);
800 } 804 }
801 /* 805 /*
@@ -873,6 +877,7 @@ static ssize_t qib_diag_write(struct file *fp, const char __user *data,
873 if (count == 4 || count == 8) { 877 if (count == 4 || count == 8) {
874 u64 data64; 878 u64 data64;
875 u32 offset = *off; 879 u32 offset = *off;
880
876 ret = copy_from_user(&data64, data, count); 881 ret = copy_from_user(&data64, data, count);
877 if (ret) { 882 if (ret) {
878 ret = -EFAULT; 883 ret = -EFAULT;