[PATCH] drivers/net/wan/sbni.c fix for 2.3.21

Mikael Pettersson (mikpe@csd.uu.se)
Tue, 12 Oct 1999 18:48:40 +0200 (MET DST)


Building 2.3.21 with CONFIG_SBNI=y (that's drivers/net/wan/sbni.c)
and gcc-2.95.1 results in:

sbni.c: In function `sbni_ioctl':
sbni.c:1283: warning: assignment makes pointer from integer without a cast
sbni.c: In function `calc_crc':
sbni.c:1375: Invalid `asm' statement:
sbni.c:1375: fixed or forbidden register 1 (dx) was spilled for class DREG.
sbni.c:1377: warning: control reaches end of non-void function

The patch below fixes these problems.

/Mikael

[I reported this before for 2.3.18ac10, but apparently the
fix was lost or queued up somewhere.]

--- linux-2.3.21/drivers/net/wan/sbni.c.~1~ Tue Oct 12 12:51:02 1999
+++ linux-2.3.21/drivers/net/wan/sbni.c Tue Oct 12 13:22:54 1999
@@ -1280,10 +1280,12 @@
return -EPERM;
if(copy_from_user( tmpstr, ifr->ifr_data, 6))
return -EFAULT;
- slave=dev_get(tmpstr);
+ slave = dev_get_by_name(tmpstr);
if(!(slave && slave->flags & IFF_UP && dev->flags & IFF_UP))
{
printk("%s: Both devices should be UP to enslave!\n",dev->name);
+ if (slave)
+ dev_put(slave);
return -EINVAL;
}

@@ -1304,8 +1306,9 @@
else
{
printk("%s: one of devices is already slave!\n",dev->name);
- return -EBUSY;
+ error = -EBUSY;
}
+ dev_put(slave);
}
else
{
@@ -1359,7 +1362,7 @@

unsigned long calc_crc(char *mem, int len, unsigned initial)
{
-
+ unsigned crc, dummy_len;
__asm__ (
"xorl %%eax,%%eax\n\t"
"1:\n\t"
@@ -1367,13 +1370,12 @@
"xorb %%dl,%%al\n\t"
"shrl $8,%%edx\n\t"
"xorl (%%edi,%%eax,4),%%edx\n\t"
- "loop 1b\n\t"
- "movl %%edx,%%eax"
- :
- : "S" (mem), "D" (&crc32tab[0]), "c" (len), "d" (initial)
- : "eax", "edx", "ecx"
+ "loop 1b"
+ : "=d" (crc), "=c" (dummy_len)
+ : "S" (mem), "D" (&crc32tab[0]), "1" (len), "0" (initial)
+ : "eax"
);
- /* return crc; */
+ return crc;
}

#else

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/