Commit 494a55d8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc64: Fix compiler warnings, from Olof Johansson

From: anton@samba.org

Fix compiler warnings, from Olof Johansson
parent d763ba8a
No related merge requests found
...@@ -331,7 +331,7 @@ static int lparcfg_data(unsigned char *buf, unsigned long size) ...@@ -331,7 +331,7 @@ static int lparcfg_data(unsigned char *buf, unsigned long size)
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
system_potential_processors = get_splpar_potential_characteristics(); system_potential_processors = get_splpar_potential_characteristics();
n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n,
"system_active_processors=%d\n", "system_active_processors=%ld\n",
(h_resource >> 2*8) & 0xffff); (h_resource >> 2*8) & 0xffff);
n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n,
"system_potential_processors=%d\n", "system_potential_processors=%d\n",
...@@ -373,16 +373,16 @@ static int lparcfg_data(unsigned char *buf, unsigned long size) ...@@ -373,16 +373,16 @@ static int lparcfg_data(unsigned char *buf, unsigned long size)
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n,
"pool=%d\n", (h_aggregation >> 0*8)&0xffff); "pool=%ld\n", (h_aggregation >> 0*8)&0xffff);
n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n,
"pool_capacity=%d\n", (h_resource >> 3*8) &0xffff); "pool_capacity=%ld\n", (h_resource >> 3*8) &0xffff);
n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n,
"group=%d\n", (h_aggregation >> 2*8)&0xffff); "group=%ld\n", (h_aggregation >> 2*8)&0xffff);
n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n,
"capped=%d\n", (h_resource >> 6*8)&0x40); "capped=%ld\n", (h_resource >> 6*8)&0x40);
n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n,
"capacity_weight=%d\n", (int)(h_resource>>5*8)&0xFF); "capacity_weight=%d\n", (int)(h_resource>>5*8)&0xFF);
......
...@@ -285,13 +285,13 @@ static ssize_t ppc_rtas_poweron_read(struct file * file, char * buf, ...@@ -285,13 +285,13 @@ static ssize_t ppc_rtas_poweron_read(struct file * file, char * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
char stkbuf[40]; /* its small, its on stack */ char stkbuf[40]; /* its small, its on stack */
int n; int n, sn;
if (power_on_time == 0) if (power_on_time == 0)
n = snprintf(stkbuf, 40, "Power on time not set\n"); n = snprintf(stkbuf, 40, "Power on time not set\n");
else else
n = snprintf(stkbuf, 40, "%lu\n", power_on_time); n = snprintf(stkbuf, 40, "%lu\n", power_on_time);
int sn = strlen (stkbuf) +1; sn = strlen (stkbuf) +1;
if (*ppos >= sn) if (*ppos >= sn)
return 0; return 0;
if (n > sn - *ppos) if (n > sn - *ppos)
...@@ -331,18 +331,19 @@ static ssize_t ppc_rtas_progress_write(struct file * file, const char * buf, ...@@ -331,18 +331,19 @@ static ssize_t ppc_rtas_progress_write(struct file * file, const char * buf,
static ssize_t ppc_rtas_progress_read(struct file * file, char * buf, static ssize_t ppc_rtas_progress_read(struct file * file, char * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
int n = 0; int sn, n = 0;
char *tmpbuf;
if (progress_led == NULL) return 0; if (progress_led == NULL) return 0;
char * tmpbuf = kmalloc (MAX_LINELENGTH, GFP_KERNEL); tmpbuf = kmalloc (MAX_LINELENGTH, GFP_KERNEL);
if (!tmpbuf) { if (!tmpbuf) {
printk(KERN_ERR "error: kmalloc failed\n"); printk(KERN_ERR "error: kmalloc failed\n");
return -ENOMEM; return -ENOMEM;
} }
n = sprintf (tmpbuf, "%s\n", progress_led); n = sprintf (tmpbuf, "%s\n", progress_led);
int sn = strlen (tmpbuf) +1; sn = strlen (tmpbuf) +1;
if (*ppos >= sn) { if (*ppos >= sn) {
kfree (tmpbuf); kfree (tmpbuf);
return 0; return 0;
...@@ -398,15 +399,14 @@ static ssize_t ppc_rtas_clock_read(struct file * file, char * buf, ...@@ -398,15 +399,14 @@ static ssize_t ppc_rtas_clock_read(struct file * file, char * buf,
{ {
unsigned int year, mon, day, hour, min, sec; unsigned int year, mon, day, hour, min, sec;
unsigned long *ret = kmalloc(4*8, GFP_KERNEL); unsigned long *ret = kmalloc(4*8, GFP_KERNEL);
int n, error; int n, sn, error;
char stkbuf[40]; /* its small, its on stack */
error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret); error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
year = ret[0]; mon = ret[1]; day = ret[2]; year = ret[0]; mon = ret[1]; day = ret[2];
hour = ret[3]; min = ret[4]; sec = ret[5]; hour = ret[3]; min = ret[4]; sec = ret[5];
char stkbuf[40]; /* its small, its on stack */
if (error != 0){ if (error != 0){
printk(KERN_WARNING "error: reading the clock returned: %s\n", printk(KERN_WARNING "error: reading the clock returned: %s\n",
ppc_rtas_process_error(error)); ppc_rtas_process_error(error));
...@@ -416,7 +416,7 @@ static ssize_t ppc_rtas_clock_read(struct file * file, char * buf, ...@@ -416,7 +416,7 @@ static ssize_t ppc_rtas_clock_read(struct file * file, char * buf,
} }
kfree(ret); kfree(ret);
int sn = strlen (stkbuf) +1; sn = strlen (stkbuf) +1;
if (*ppos >= sn) if (*ppos >= sn)
return 0; return 0;
if (n > sn - *ppos) if (n > sn - *ppos)
...@@ -860,11 +860,12 @@ static ssize_t ppc_rtas_tone_freq_write(struct file * file, const char * buf, ...@@ -860,11 +860,12 @@ static ssize_t ppc_rtas_tone_freq_write(struct file * file, const char * buf,
static ssize_t ppc_rtas_tone_freq_read(struct file * file, char * buf, static ssize_t ppc_rtas_tone_freq_read(struct file * file, char * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
int n; int n, sn;
char stkbuf[40]; /* its small, its on stack */ char stkbuf[40]; /* its small, its on stack */
n = snprintf(stkbuf, 40, "%lu\n", rtas_tone_frequency); n = snprintf(stkbuf, 40, "%lu\n", rtas_tone_frequency);
int sn = strlen (stkbuf) +1; sn = strlen (stkbuf) +1;
if (*ppos >= sn) if (*ppos >= sn)
return 0; return 0;
if (n > sn - *ppos) if (n > sn - *ppos)
...@@ -913,11 +914,12 @@ static ssize_t ppc_rtas_tone_volume_write(struct file * file, const char * buf, ...@@ -913,11 +914,12 @@ static ssize_t ppc_rtas_tone_volume_write(struct file * file, const char * buf,
static ssize_t ppc_rtas_tone_volume_read(struct file * file, char * buf, static ssize_t ppc_rtas_tone_volume_read(struct file * file, char * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
int n; int n, sn;
char stkbuf[40]; /* its small, its on stack */ char stkbuf[40]; /* its small, its on stack */
n = snprintf(stkbuf, 40, "%lu\n", rtas_tone_volume); n = snprintf(stkbuf, 40, "%lu\n", rtas_tone_volume);
int sn = strlen (stkbuf) +1; sn = strlen (stkbuf) +1;
if (*ppos >= sn) if (*ppos >= sn)
return 0; return 0;
if (n > sn - *ppos) if (n > sn - *ppos)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment