[PATCH] Inconsistency in prism2_download_genesis()
Pavel Roskin
proski
Tue Dec 23 00:25:36 PST 2003
Hello!
prism2_download_genesis() can return 1, -1 or negative error code for
different errors. prism2_hw_reset() calls prism2_download_genesis() and
assumes that only negative return values are errors.
Also, the return value of prism2_download_genesis() can be returned by
hostap_ioctl(), so it's better to use negative error codes.
The patch is attached. I don't feel strong about using EIO, feel free to
change to another code.
--
Regards,
Pavel Roskin
-------------- next part --------------
--- driver/modules/hostap_download.c
+++ driver/modules/hostap_download.c
@@ -364,7 +364,7 @@ static int prism2_download_genesis(local
if (local->hw_downloading) {
printk(KERN_WARNING "%s: Already downloading - aborting new "
"request\n", dev->name);
- return -1;
+ return -EBUSY;
}
if (!local->func->genesis_reset || !local->func->cor_sreset) {
@@ -378,7 +378,7 @@ static int prism2_download_genesis(local
if (prism2_enable_aux_port(dev, 1)) {
printk(KERN_DEBUG "%s: failed to enable AUX port\n",
dev->name);
- return 1;
+ return -EIO;
}
/* 0x1F for x8 SRAM or 0x0F for x16 SRAM */
@@ -393,7 +393,7 @@ static int prism2_download_genesis(local
} else {
printk(KERN_DEBUG "%s: Could not initiate genesis mode\n",
dev->name);
- return 1;
+ return -EIO;
}
for (i = 0; i < param->num_areas; i++) {
@@ -404,7 +404,7 @@ static int prism2_download_genesis(local
printk(KERN_WARNING "%s: RAM download at 0x%08x "
"(len=%d) failed\n", dev->name,
param->data[i].addr, param->data[i].len);
- return 1;
+ return -EIO;
}
}
@@ -420,13 +420,13 @@ static int prism2_download_genesis(local
printk(KERN_DEBUG "Trying to initialize card\n");
if (prism2_hw_init(dev, 1)) {
printk(KERN_DEBUG "Initialization failed\n");
- return 1;
+ return -EIO;
}
printk(KERN_DEBUG "Card initialized - running PRI only\n");
if (prism2_hw_init(dev, 1) || prism2_hw_init2(dev, 1)) {
printk(KERN_DEBUG "Initialization failed\n");
- return 1;
+ return -EIO;
}
return 0;
More information about the Hostap
mailing list