Staging: otus: fix some sparse warnings
*apdbg.c: use NULL pointer instead of 0 interger. Also make two functions private. Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bb0bfc2a6b
commit
cb13887657
@@ -90,8 +90,27 @@ struct zdap_ioctl {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char hex(char);
|
static char hex(char v)
|
||||||
unsigned char asctohex(char *str);
|
{
|
||||||
|
if (isdigit(v))
|
||||||
|
return v - '0';
|
||||||
|
else if (isxdigit(v))
|
||||||
|
return tolower(v) - 'a' + 10;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char asctohex(char *str)
|
||||||
|
{
|
||||||
|
unsigned char value;
|
||||||
|
|
||||||
|
value = hex(*str) & 0x0f;
|
||||||
|
value = value << 4;
|
||||||
|
str++;
|
||||||
|
value |= hex(*str) & 0x0f;
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
char *prgname;
|
char *prgname;
|
||||||
|
|
||||||
@@ -109,10 +128,10 @@ int set_ioctl(int sock, struct ifreq *req)
|
|||||||
|
|
||||||
int read_reg(int sock, struct ifreq *req)
|
int read_reg(int sock, struct ifreq *req)
|
||||||
{
|
{
|
||||||
struct zdap_ioctl *zdreq = 0;
|
struct zdap_ioctl *zdreq = NULL;
|
||||||
|
|
||||||
if (!set_ioctl(sock, req))
|
if (!set_ioctl(sock, req))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* zdreq = (struct zdap_ioctl *)req->ifr_data;
|
* zdreq = (struct zdap_ioctl *)req->ifr_data;
|
||||||
@@ -125,7 +144,7 @@ int read_reg(int sock, struct ifreq *req)
|
|||||||
|
|
||||||
int read_mem(int sock, struct ifreq *req)
|
int read_mem(int sock, struct ifreq *req)
|
||||||
{
|
{
|
||||||
struct zdap_ioctl *zdreq = 0;
|
struct zdap_ioctl *zdreq = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!set_ioctl(sock, req))
|
if (!set_ioctl(sock, req))
|
||||||
@@ -368,7 +387,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
zdreq.addr = addr;
|
zdreq.addr = addr;
|
||||||
zdreq.cmd = ZM_IOCTL_SET_PIBSS_MODE;
|
zdreq.cmd = ZM_IOCTL_SET_PIBSS_MODE;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "error action\n");
|
fprintf(stderr, "error action\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -380,25 +399,3 @@ fail:
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char asctohex(char *str)
|
|
||||||
{
|
|
||||||
unsigned char value;
|
|
||||||
|
|
||||||
value = hex(*str) & 0x0f;
|
|
||||||
value = value << 4;
|
|
||||||
str++;
|
|
||||||
value |= hex(*str) & 0x0f;
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
char hex(char v)
|
|
||||||
{
|
|
||||||
if (isdigit(v))
|
|
||||||
return v - '0';
|
|
||||||
else if (isxdigit(v))
|
|
||||||
return tolower(v) - 'a' + 10;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user