aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pcmcia/ds.c4
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c5
-rw-r--r--drivers/pcmcia/pcmcia_resource.c24
-rw-r--r--include/pcmcia/cs.h8
4 files changed, 22 insertions, 19 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 4092a5976e62..3ccf4091e877 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -75,10 +75,6 @@ typedef struct lookup_t {
75 75
76static const lookup_t error_table[] = { 76static const lookup_t error_table[] = {
77 { 0, "Operation succeeded" }, 77 { 0, "Operation succeeded" },
78 { CS_BAD_BASE, "Bad base address" },
79 { CS_BAD_IRQ, "Bad IRQ" },
80 { CS_BAD_OFFSET, "Bad offset" },
81 { CS_BAD_SIZE, "Bad size" },
82 { -EIO, "Input/Output error" }, 78 { -EIO, "Input/Output error" },
83 { -ENODEV, "No card present" }, 79 { -ENODEV, "No card present" },
84 { -EINVAL, "Bad parameter" }, 80 { -EINVAL, "Bad parameter" },
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index e27c71ebfda2..99563134ac0f 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -149,7 +149,7 @@ static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj)
149 149
150 irq = adj->resource.irq.IRQ; 150 irq = adj->resource.irq.IRQ;
151 if ((irq < 0) || (irq > 15)) 151 if ((irq < 0) || (irq > 15))
152 return CS_BAD_IRQ; 152 return -EINVAL;
153 153
154 if (adj->Action != REMOVE_MANAGED_RESOURCE) 154 if (adj->Action != REMOVE_MANAGED_RESOURCE)
155 return 0; 155 return 0;
@@ -970,8 +970,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
970 case -ENOSYS: 970 case -ENOSYS:
971 err = ret; 971 err = ret;
972 break; 972 break;
973 case CS_BAD_ARGS: case CS_BAD_IRQ: 973 case CS_BAD_ARGS: case CS_BAD_TUPLE:
974 case CS_BAD_TUPLE:
975 err = -EINVAL; break; 974 err = -EINVAL; break;
976 case -ENOMEM: 975 case -ENOMEM:
977 err = -ENOSPC; break; 976 err = -ENOSPC; break;
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 35a61577ae4e..fee57139a96f 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -257,8 +257,10 @@ int pcmcia_map_mem_page(window_handle_t win, memreq_t *req)
257 return -EINVAL; 257 return -EINVAL;
258 } 258 }
259 win->ctl.card_start = req->CardOffset; 259 win->ctl.card_start = req->CardOffset;
260 if (s->ops->set_mem_map(s, &win->ctl) != 0) 260 if (s->ops->set_mem_map(s, &win->ctl) != 0) {
261 return CS_BAD_OFFSET; 261 ds_dbg(s, 0, "failed to set_mem_map\n");
262 return -EIO;
263 }
262 return 0; 264 return 0;
263} /* pcmcia_map_mem_page */ 265} /* pcmcia_map_mem_page */
264EXPORT_SYMBOL(pcmcia_map_mem_page); 266EXPORT_SYMBOL(pcmcia_map_mem_page);
@@ -426,8 +428,10 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
426 ds_dbg(s, 0, "IRQ attributes must match assigned ones\n"); 428 ds_dbg(s, 0, "IRQ attributes must match assigned ones\n");
427 return -EINVAL; 429 return -EINVAL;
428 } 430 }
429 if (s->irq.AssignedIRQ != req->AssignedIRQ) 431 if (s->irq.AssignedIRQ != req->AssignedIRQ) {
430 return CS_BAD_IRQ; 432 ds_dbg(s, 0, "IRQ must match assigned one\n");
433 return -EINVAL;
434 }
431 if (--s->irq.Config == 0) { 435 if (--s->irq.Config == 0) {
432 c->state &= ~CONFIG_IRQ_REQ; 436 c->state &= ~CONFIG_IRQ_REQ;
433 s->irq.AssignedIRQ = 0; 437 s->irq.AssignedIRQ = 0;
@@ -802,11 +806,15 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
802 align = (((s->features & SS_CAP_MEM_ALIGN) || 806 align = (((s->features & SS_CAP_MEM_ALIGN) ||
803 (req->Attributes & WIN_STRICT_ALIGN)) ? 807 (req->Attributes & WIN_STRICT_ALIGN)) ?
804 req->Size : s->map_size); 808 req->Size : s->map_size);
805 if (req->Size & (s->map_size-1)) 809 if (req->Size & (s->map_size-1)) {
806 return CS_BAD_SIZE; 810 ds_dbg(s, 0, "invalid map size\n");
811 return -EINVAL;
812 }
807 if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || 813 if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) ||
808 (req->Base & (align-1))) 814 (req->Base & (align-1))) {
809 return CS_BAD_BASE; 815 ds_dbg(s, 0, "invalid base address\n");
816 return -EINVAL;
817 }
810 if (req->Base) 818 if (req->Base)
811 align = 0; 819 align = 0;
812 820
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 70c32e97b492..4951eb94493a 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -291,13 +291,13 @@ typedef struct error_info_t {
291#define CS_SUCCESS 0x00 291#define CS_SUCCESS 0x00
292#define CS_BAD_ADAPTER -ENODEV 292#define CS_BAD_ADAPTER -ENODEV
293#define CS_BAD_ATTRIBUTE -EINVAL 293#define CS_BAD_ATTRIBUTE -EINVAL
294#define CS_BAD_BASE 0x03 294#define CS_BAD_BASE -EINVAL
295#define CS_BAD_EDC -ENODEV 295#define CS_BAD_EDC -ENODEV
296#define CS_BAD_IRQ 0x06 296#define CS_BAD_IRQ -EINVAL
297#define CS_BAD_OFFSET 0x07 297#define CS_BAD_OFFSET -EIO
298#define CS_BAD_PAGE -EINVAL 298#define CS_BAD_PAGE -EINVAL
299#define CS_READ_FAILURE -EIO 299#define CS_READ_FAILURE -EIO
300#define CS_BAD_SIZE 0x0a 300#define CS_BAD_SIZE -EINVAL
301#define CS_BAD_SOCKET -EINVAL 301#define CS_BAD_SOCKET -EINVAL
302#define CS_BAD_TYPE -EINVAL 302#define CS_BAD_TYPE -EINVAL
303#define CS_BAD_VCC -EINVAL 303#define CS_BAD_VCC -EINVAL