Commit cb138876 authored by Thiago Farina's avatar Thiago Farina Committed by Greg Kroah-Hartman
Browse files

Staging: otus: fix some sparse warnings



*apdbg.c: use NULL pointer instead of 0 interger. Also make two functions private.

Signed-off-by: default avatarThiago Farina <tfransosi@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent bb0bfc2a
Loading
Loading
Loading
Loading
+25 −28
Original line number Diff line number Diff line
@@ -90,8 +90,27 @@ struct zdap_ioctl {

#endif

char hex(char);
unsigned char asctohex(char *str);
static char hex(char v)
{
	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;

@@ -109,7 +128,7 @@ int set_ioctl(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))
		return -1;
@@ -125,7 +144,7 @@ int read_reg(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;

	if (!set_ioctl(sock, req))
@@ -380,25 +399,3 @@ fail:
	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;
}