Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756547Ab1EPXgA (ORCPT ); Mon, 16 May 2011 19:36:00 -0400 Received: from smtp-out.google.com ([216.239.44.51]:62514 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752393Ab1EPXf6 (ORCPT ); Mon, 16 May 2011 19:35:58 -0400 From: Mandeep Singh Baines To: linux-kernel@vger.kernel.org Cc: Mandeep Singh Baines , Marcin Slusarz , Don Zickus , Peter Zijlstra , Frederic Weisbecker , Ingo Molnar Subject: [PATCH 2/4] watchdog: only disable/enable watchdog if neccessary Date: Mon, 16 May 2011 16:34:59 -0700 Message-Id: <1305588901-8141-2-git-send-email-msb@chromium.org> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1305588901-8141-1-git-send-email-msb@chromium.org> References: <1305588901-8141-1-git-send-email-msb@chromium.org> X-System-Of-Record: true Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1474 Lines: 52 Don't take any action on an unsuccessful write to /proc. Signed-off-by: Mandeep Singh Baines Cc: Marcin Slusarz Cc: Don Zickus Cc: Peter Zijlstra Cc: Frederic Weisbecker Cc: Ingo Molnar --- kernel/watchdog.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index a06972d..cf0e09f 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -507,15 +507,19 @@ static void watchdog_disable_all_cpus(void) int proc_dowatchdog_enabled(struct ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos) { - proc_dointvec(table, write, buffer, length, ppos); + int ret; - if (write) { - if (watchdog_enabled) - watchdog_enable_all_cpus(); - else - watchdog_disable_all_cpus(); - } - return 0; + ret = proc_dointvec(table, write, buffer, length, ppos); + if (ret || !write) + goto out; + + if (watchdog_enabled) + watchdog_enable_all_cpus(); + else + watchdog_disable_all_cpus(); + +out: + return ret; } int proc_dowatchdog_thresh(struct ctl_table *table, int write, -- 1.7.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/