All of lore.kernel.org
 help / color / mirror / Atom feed
From: dann frazier <dannf@hp.com>
To: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-kernel@vger.kernel.org,
	Thomas Mingarelli <thomas.mingarelli@hp.com>
Subject: Re: [PATCH 12/15] Construct status message w/ kasprintf and emit it with dev_info
Date: Wed, 28 Jul 2010 12:38:43 -0600	[thread overview]
Message-ID: <20100728183843.GD22656@ldl.fc.hp.com> (raw)
In-Reply-To: <1280274663-9160-13-git-send-email-dannf@hp.com>

On Tue, Jul 27, 2010 at 05:51:00PM -0600, dann frazier wrote:
> Constructing the string dynamically w/ kasprintf will make it easier to
> ifdef-out parts of it. Also, this is for a device, so let's use
> dev_info.

A coworker caught a silly mistake in this one - I missed
freeing the buf allocated by kasprintf.

Here's a fixed patch.



Construct status message w/ kasprintf and emit it with dev_info

Constructing the string dynamically w/ kasprintf will make it easier to
ifdef-out parts of it. Also, this is for a device, so let's use dev_info.
    
Signed-off-by: dann frazier <dannf@hp.com>

diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index f46e4f2..f03078d 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -658,6 +658,7 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev,
 					const struct pci_device_id *ent)
 {
 	int retval;
+	char *buf;
 
 	/*
 	 * Check if we can do NMI sourcing or not
@@ -741,14 +742,17 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev,
 		goto error_misc_register;
 	}
 
-	printk(KERN_INFO
-		"hp Watchdog Timer Driver: %s"
-		", timer margin: %d seconds (nowayout=%d)"
-		", allow kernel dump: %s (default = 0/OFF)"
-		", priority: %s (default = 0/LAST).\n",
-		HPWDT_VERSION, soft_margin, nowayout,
-		(allow_kdump == 0) ? "OFF" : "ON",
-		(priority == 0) ? "LAST" : "FIRST");
+	buf = kasprintf(GFP_KERNEL, "hp Watchdog Timer Driver: %s"
+			", timer margin: %d seconds (nowayout=%d)"
+			", allow kernel dump: %s (default = 0/OFF)"
+			", priority: %s (default = 0/LAST)",
+			HPWDT_VERSION, soft_margin, nowayout,
+			(allow_kdump == 0) ? "OFF" : "ON",
+			(priority == 0) ? "LAST" : "FIRST");
+	if (!buf)
+		goto error_nomem;
+	dev_info(&dev->dev, "%s.\n", buf);
+	kfree(buf);
 
 	return 0;
 
@@ -761,6 +765,7 @@ error_get_cru:
 	pci_iounmap(dev, pci_mem_addr);
 error_pci_iomap:
 	pci_disable_device(dev);
+error_nomem:
 	return retval;
 }
 

  reply	other threads:[~2010-07-28 18:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27 23:50 [PATCH 00/15] hpwdt: make NMI code a config option (+ other cleanup) dann frazier
2010-07-27 23:50 ` [PATCH 01/15] hpwdt_pretimeout reorganization dann frazier
2010-07-27 23:50 ` [PATCH 02/15] remove unnecessary includes dann frazier
2010-07-27 23:50 ` [PATCH 03/15] include spinlock.h dann frazier
2010-07-27 23:50 ` [PATCH 04/15] add include for linux/bitops.h dann frazier
2010-07-27 23:50 ` [PATCH 05/15] Group together includes specific to NMI sourcing dann frazier
2010-07-27 23:50 ` [PATCH 06/15] Group options that affect watchdog behavior together dann frazier
2010-07-27 23:50 ` [PATCH 07/15] Group defines only used by NMI sourcing together dann frazier
2010-07-27 23:50 ` [PATCH 08/15] Group declarations specific to " dann frazier
2010-07-27 23:50 ` [PATCH 09/15] Despecificate driver from iLO2 dann frazier
2010-08-04 20:13   ` Wim Van Sebroeck
2010-08-04 20:18     ` Mingarelli, Thomas
2010-08-05  5:10     ` dann frazier
2010-07-27 23:50 ` [PATCH 10/15] Fix a typo dann frazier
2010-07-27 23:50 ` [PATCH 11/15] Make x86 assembly ifdef guard more strict dann frazier
2010-07-27 23:51 ` [PATCH 12/15] Construct status message w/ kasprintf and emit it with dev_info dann frazier
2010-07-28 18:38   ` dann frazier [this message]
2010-07-27 23:51 ` [PATCH 13/15] Use "decoding" instead of "sourcing" dann frazier
2010-07-27 23:51 ` [PATCH 14/15] Make NMI decoding a compile-time option dann frazier
2010-07-27 23:51 ` [PATCH 15/15] Bump version to 1.2.0 dann frazier
2010-07-28 13:10 ` [PATCH 00/15] hpwdt: make NMI code a config option (+ other cleanup) Mingarelli, Thomas
2010-08-05 21:41 ` Wim Van Sebroeck
2010-08-06 21:26   ` Wim Van Sebroeck
2010-08-06 21:29     ` dann frazier
2010-08-11 12:49       ` Wim Van Sebroeck
2010-08-13  7:29         ` dann frazier

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=20100728183843.GD22656@ldl.fc.hp.com \
    --to=dannf@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.mingarelli@hp.com \
    --cc=wim@iguana.be \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.