aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/rsrc_nonstatic.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-03 04:22:47 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 20:29:40 -0400
commit1168386aa7d850ead2ae135d5a7949a592c6e9a0 (patch)
tree9b36c2220df778fa74af93befb641c0569a5e862 /drivers/pcmcia/rsrc_nonstatic.c
parent5ff87db6792844ae24cc784512a95e0c94521b19 (diff)
pcmcia: deprecate CS_OUT_OF_RESOURCE
CS_OUT_OF_RESOURCE was almost only used to note -ENOMEM situations. Therefore, use -ENOMEM explicitely, and also print out warnings. CC: netdev@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/rsrc_nonstatic.c')
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 9d04fb214ec2..0e4141bac7b1 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -122,19 +122,22 @@ static void free_region(struct resource *res)
122 122
123static int add_interval(struct resource_map *map, u_long base, u_long num) 123static int add_interval(struct resource_map *map, u_long base, u_long num)
124{ 124{
125 struct resource_map *p, *q; 125 struct resource_map *p, *q;
126 126
127 for (p = map; ; p = p->next) { 127 for (p = map; ; p = p->next) {
128 if ((p != map) && (p->base+p->num-1 >= base)) 128 if ((p != map) && (p->base+p->num-1 >= base))
129 return -1; 129 return -1;
130 if ((p->next == map) || (p->next->base > base+num-1)) 130 if ((p->next == map) || (p->next->base > base+num-1))
131 break; 131 break;
132 } 132 }
133 q = kmalloc(sizeof(struct resource_map), GFP_KERNEL); 133 q = kmalloc(sizeof(struct resource_map), GFP_KERNEL);
134 if (!q) return CS_OUT_OF_RESOURCE; 134 if (!q) {
135 q->base = base; q->num = num; 135 printk(KERN_WARNING "out of memory to update resources\n");
136 q->next = p->next; p->next = q; 136 return -ENOMEM;
137 return 0; 137 }
138 q->base = base; q->num = num;
139 q->next = p->next; p->next = q;
140 return 0;
138} 141}
139 142
140/*====================================================================*/ 143/*====================================================================*/
@@ -166,7 +169,10 @@ static int sub_interval(struct resource_map *map, u_long base, u_long num)
166 } else { 169 } else {
167 /* Split the block into two pieces */ 170 /* Split the block into two pieces */
168 p = kmalloc(sizeof(struct resource_map), GFP_KERNEL); 171 p = kmalloc(sizeof(struct resource_map), GFP_KERNEL);
169 if (!p) return CS_OUT_OF_RESOURCE; 172 if (!p) {
173 printk(KERN_WARNING "out of memory to update resources\n");
174 return -ENOMEM;
175 }
170 p->base = base+num; 176 p->base = base+num;
171 p->num = q->base+q->num - p->base; 177 p->num = q->base+q->num - p->base;
172 q->num = base - q->base; 178 q->num = base - q->base;