mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: [PATCH 22/27] proc: Remove use of seq_printf return value
Date: Sat, 21 Feb 2015 18:53:49 -0800	[thread overview]
Message-ID: <ed346ab06bb327f93bdc8d1b1aa1da41419bf934.1424573328.git.joe@perches.com> (raw)
In-Reply-To: <cover.1424573328.git.joe@perches.com>

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
     seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/proc/array.c |  4 ++-
 fs/proc/base.c  | 82 +++++++++++++++++++++++++++++++++------------------------
 2 files changed, 50 insertions(+), 36 deletions(-)

diff --git a/fs/proc/array.c b/fs/proc/array.c
index 1295a00..e49353b 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -614,7 +614,9 @@ static int children_seq_show(struct seq_file *seq, void *v)
 	pid_t pid;
 
 	pid = pid_nr_ns(v, inode->i_sb->s_fs_info);
-	return seq_printf(seq, "%d ", pid);
+	seq_printf(seq, "%d ", pid);
+
+	return 0;
 }
 
 static void *children_seq_start(struct seq_file *seq, loff_t *pos)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 3f3d7ae..7a3b82f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -238,13 +238,15 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
 
 	wchan = get_wchan(task);
 
-	if (lookup_symbol_name(wchan, symname) < 0)
+	if (lookup_symbol_name(wchan, symname) < 0) {
 		if (!ptrace_may_access(task, PTRACE_MODE_READ))
 			return 0;
-		else
-			return seq_printf(m, "%lu", wchan);
-	else
-		return seq_printf(m, "%s", symname);
+		seq_printf(m, "%lu", wchan);
+	} else {
+		seq_printf(m, "%s", symname);
+	}
+
+	return 0;
 }
 #endif /* CONFIG_KALLSYMS */
 
@@ -309,10 +311,12 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
 static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns,
 			      struct pid *pid, struct task_struct *task)
 {
-	return seq_printf(m, "%llu %llu %lu\n",
-			(unsigned long long)task->se.sum_exec_runtime,
-			(unsigned long long)task->sched_info.run_delay,
-			task->sched_info.pcount);
+	seq_printf(m, "%llu %llu %lu\n",
+		   (unsigned long long)task->se.sum_exec_runtime,
+		   (unsigned long long)task->sched_info.run_delay,
+		   task->sched_info.pcount);
+
+	return 0;
 }
 #endif
 
@@ -387,7 +391,9 @@ static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
 		points = oom_badness(task, NULL, NULL, totalpages) *
 						1000 / totalpages;
 	read_unlock(&tasklist_lock);
-	return seq_printf(m, "%lu\n", points);
+	seq_printf(m, "%lu\n", points);
+
+	return 0;
 }
 
 struct limit_names {
@@ -432,15 +438,15 @@ static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns,
 	 * print the file header
 	 */
        seq_printf(m, "%-25s %-20s %-20s %-10s\n",
-			"Limit", "Soft Limit", "Hard Limit", "Units");
+		  "Limit", "Soft Limit", "Hard Limit", "Units");
 
 	for (i = 0; i < RLIM_NLIMITS; i++) {
 		if (rlim[i].rlim_cur == RLIM_INFINITY)
 			seq_printf(m, "%-25s %-20s ",
-					 lnames[i].name, "unlimited");
+				   lnames[i].name, "unlimited");
 		else
 			seq_printf(m, "%-25s %-20lu ",
-					 lnames[i].name, rlim[i].rlim_cur);
+				   lnames[i].name, rlim[i].rlim_cur);
 
 		if (rlim[i].rlim_max == RLIM_INFINITY)
 			seq_printf(m, "%-20s ", "unlimited");
@@ -462,7 +468,9 @@ static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,
 {
 	long nr;
 	unsigned long args[6], sp, pc;
-	int res = lock_trace(task);
+	int res;
+
+	res = lock_trace(task);
 	if (res)
 		return res;
 
@@ -477,7 +485,8 @@ static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,
 		       args[0], args[1], args[2], args[3], args[4], args[5],
 		       sp, pc);
 	unlock_trace(task);
-	return res;
+
+	return 0;
 }
 #endif /* CONFIG_HAVE_ARCH_TRACEHOOK */
 
@@ -2002,12 +2011,13 @@ static int show_timer(struct seq_file *m, void *v)
 	notify = timer->it_sigev_notify;
 
 	seq_printf(m, "ID: %d\n", timer->it_id);
-	seq_printf(m, "signal: %d/%p\n", timer->sigq->info.si_signo,
-			timer->sigq->info.si_value.sival_ptr);
+	seq_printf(m, "signal: %d/%p\n",
+		   timer->sigq->info.si_signo,
+		   timer->sigq->info.si_value.sival_ptr);
 	seq_printf(m, "notify: %s/%s.%d\n",
-		nstr[notify & ~SIGEV_THREAD_ID],
-		(notify & SIGEV_THREAD_ID) ? "tid" : "pid",
-		pid_nr_ns(timer->it_pid, tp->ns));
+		   nstr[notify & ~SIGEV_THREAD_ID],
+		   (notify & SIGEV_THREAD_ID) ? "tid" : "pid",
+		   pid_nr_ns(timer->it_pid, tp->ns));
 	seq_printf(m, "ClockID: %d\n", timer->it_clock);
 
 	return 0;
@@ -2352,21 +2362,23 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh
 
 		unlock_task_sighand(task, &flags);
 	}
-	result = seq_printf(m,
-			"rchar: %llu\n"
-			"wchar: %llu\n"
-			"syscr: %llu\n"
-			"syscw: %llu\n"
-			"read_bytes: %llu\n"
-			"write_bytes: %llu\n"
-			"cancelled_write_bytes: %llu\n",
-			(unsigned long long)acct.rchar,
-			(unsigned long long)acct.wchar,
-			(unsigned long long)acct.syscr,
-			(unsigned long long)acct.syscw,
-			(unsigned long long)acct.read_bytes,
-			(unsigned long long)acct.write_bytes,
-			(unsigned long long)acct.cancelled_write_bytes);
+	seq_printf(m,
+		   "rchar: %llu\n"
+		   "wchar: %llu\n"
+		   "syscr: %llu\n"
+		   "syscw: %llu\n"
+		   "read_bytes: %llu\n"
+		   "write_bytes: %llu\n"
+		   "cancelled_write_bytes: %llu\n",
+		   (unsigned long long)acct.rchar,
+		   (unsigned long long)acct.wchar,
+		   (unsigned long long)acct.syscr,
+		   (unsigned long long)acct.syscw,
+		   (unsigned long long)acct.read_bytes,
+		   (unsigned long long)acct.write_bytes,
+		   (unsigned long long)acct.cancelled_write_bytes);
+	result = 0;
+
 out_unlock:
 	mutex_unlock(&task->signal->cred_guard_mutex);
 	return result;
-- 
2.1.2


  parent reply	other threads:[~2015-02-22  2:55 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-22  2:53 [PATCH 00/27] Convert seq_<foo> output calls to return void Joe Perches
2015-02-22  2:53 ` [PATCH 01/27] staging: lustre: Convert "return seq_printf(...)" uses Joe Perches
2015-02-22  2:53 ` [PATCH 02/27] staging: lustre: Convert seq_ hash functions to return void Joe Perches
2015-02-22  2:53 ` [PATCH 03/27] staging: lustre: Convert uses of "int rc = seq_printf(...)" Joe Perches
2015-03-02  1:22   ` Greg Kroah-Hartman
2015-03-02  3:58     ` [PATCH 03/27 V2] " Joe Perches
2015-02-22  2:53 ` [PATCH 04/27] staging: lustre: Convert remaining uses of "= seq_printf(...)" Joe Perches
2015-02-22  2:53 ` [PATCH 05/27] x86: mtrr: if: Remove use of seq_printf return value Joe Perches
2015-02-22  2:53 ` [PATCH 06/27] power: wakeup: " Joe Perches
2015-02-22 21:38   ` Pavel Machek
2015-02-22 21:52     ` Joe Perches
2015-02-23 11:54       ` Pavel Machek
2015-02-22  2:53 ` [PATCH 07/27] ipmi: " Joe Perches
2015-02-23 23:50   ` Andrew Morton
2015-02-24  1:23     ` Joe Perches
2015-02-22  2:53 ` [PATCH 08/27] rtc: " Joe Perches
2015-02-22  2:53 ` [PATCH 09/27] ipc: " Joe Perches
2015-02-22  2:53 ` [PATCH 10/27] pxa27x_udc: " Joe Perches
2015-02-22 10:22   ` Robert Jarzmik
2015-02-22  2:53 ` [PATCH 11/27] microblaze: mb: " Joe Perches
2015-02-23 11:39   ` Michal Simek
2015-02-22  2:53 ` [PATCH 12/27] nios2: cpuinfo: " Joe Perches
2015-02-22  2:53 ` [PATCH 13/27] ARM: plat-pxa: " Joe Perches
2015-02-22  2:53 ` [PATCH 14/27] openrisc: " Joe Perches
2015-02-22  2:53 ` [PATCH 15/27] cris: " Joe Perches
2015-02-22  2:53 ` [PATCH 16/27] mfd: ab8500-debugfs: " Joe Perches
2015-03-06 10:54   ` Lee Jones
2015-02-22  2:53 ` [PATCH 17/27] staging: i2o: " Joe Perches
2015-02-22  2:53 ` [PATCH 18/27] staging: rtl8192x: " Joe Perches
2015-02-22  2:53 ` [PATCH 19/27] s390: " Joe Perches
2015-02-22 12:53   ` Sebastian Ott
2015-02-22  2:53 ` [PATCH 20/27] i8k: " Joe Perches
2015-02-22  4:55   ` Guenter Roeck
2015-02-22  2:53 ` [PATCH 21/27] watchdog: bcm281xx: " Joe Perches
2015-02-23 19:29   ` [21/27] " Guenter Roeck
2015-03-27  7:57   ` [PATCH 21/27] " Wim Van Sebroeck
2015-02-22  2:53 ` Joe Perches [this message]
2015-02-22  2:53 ` [PATCH 23/27] cgroup: " Joe Perches
2015-02-22 13:41   ` Tejun Heo
2015-02-22  2:53 ` [PATCH 24/27] tracing: " Joe Perches
2015-02-22  3:54   ` Steven Rostedt
2015-02-22  4:41     ` Al Viro
2015-02-22 10:39       ` Joe Perches
2015-02-23 17:20         ` Steven Rostedt
2015-02-23 17:36           ` Joe Perches
2015-02-22  2:53 ` [PATCH 25/27] lru_cache: " Joe Perches
2015-02-22  2:53 ` [PATCH 26/27] parisc: " Joe Perches
2015-02-22  2:53 ` [PATCH 27/27] regulator: dbx500: Remove use of seq_puts/seq_printf " Joe Perches
2015-02-23 13:55   ` Mark Brown
2015-02-23 14:52     ` Joe Perches
2015-02-24  8:18       ` Mark Brown
2015-02-22  4:00 ` [PATCH V2 - 15/27] cris: Remove use of seq_printf " Joe Perches
2015-02-23  7:18   ` Jesper Nilsson
2015-02-22  4:02 ` [PATCH V2 - 08/27] rtc: " Joe Perches
2015-02-26 12:10 ` [PATCH 11/27 v2] microblaze: mb: " Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ed346ab06bb327f93bdc8d1b1aa1da41419bf934.1424573328.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®