All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <fengguang.wu@intel.com>
To: Lance Ortiz <lance.ortiz@hp.com>
Cc: kernel-janitors@vger.kernel.org, Len Brown <len.brown@intel.com>,
	linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org
Subject: [acpi:next 4/5] drivers/acpi/scan.c:328 acpi_device_remove_files() info: redundant null check on dev
Date: Tue, 02 Oct 2012 07:39:52 +0000	[thread overview]
Message-ID: <20121002073952.GA24180@localhost> (raw)

Hi Lance,

FYI, there are new smatch warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git next
head:   10eaea0474b0078bb84ff9009329b83d3e30337f
commit: 2bc8195d56163f54d3036304efa8d71ab1091bf1 [4/5] ACPI: Add new sysfs interface to export device description

+ drivers/acpi/scan.c:328 acpi_device_remove_files() info: redundant null check on dev->pnp.str_obj calling kfree()

vim +328 drivers/acpi/scan.c

e49bd2dd (Zhang Rui      2006-12-08  312) 		result = device_create_file(&dev->dev, &dev_attr_eject);
0c526d96 (Alex Chiang    2009-05-14  313) end:
e49bd2dd (Zhang Rui      2006-12-08  314) 	return result;
^1da177e (Linus Torvalds 2005-04-16  315) }
^1da177e (Linus Torvalds 2005-04-16  316) 
f883d9db (Patrick Mochel 2006-12-07  317) static void acpi_device_remove_files(struct acpi_device *dev)
^1da177e (Linus Torvalds 2005-04-16  318) {
f883d9db (Patrick Mochel 2006-12-07  319) 	acpi_status status;
f883d9db (Patrick Mochel 2006-12-07  320) 	acpi_handle temp;
^1da177e (Linus Torvalds 2005-04-16  321) 
f883d9db (Patrick Mochel 2006-12-07  322) 	/*
2bc8195d (Lance Ortiz    2012-09-07  323) 	 * If device has _STR, remove 'description' file
2bc8195d (Lance Ortiz    2012-09-07  324) 	 */
2bc8195d (Lance Ortiz    2012-09-07  325) 	status = acpi_get_handle(dev->handle, "_STR", &temp);
2bc8195d (Lance Ortiz    2012-09-07  326) 	if (ACPI_SUCCESS(status)) {
2bc8195d (Lance Ortiz    2012-09-07  327) 		if (dev->pnp.str_obj != NULL)
2bc8195d (Lance Ortiz    2012-09-07 @328) 			kfree(dev->pnp.str_obj);
2bc8195d (Lance Ortiz    2012-09-07  329) 		device_remove_file(&dev->dev, &dev_attr_description);
2bc8195d (Lance Ortiz    2012-09-07  330) 	}
2bc8195d (Lance Ortiz    2012-09-07  331) 	/*
2bc8195d (Lance Ortiz    2012-09-07  332) 	 * If device has _EJ0, remove 'eject' file.
f883d9db (Patrick Mochel 2006-12-07  333) 	 */
f883d9db (Patrick Mochel 2006-12-07  334) 	status = acpi_get_handle(dev->handle, "_EJ0", &temp);
f883d9db (Patrick Mochel 2006-12-07  335) 	if (ACPI_SUCCESS(status))
f883d9db (Patrick Mochel 2006-12-07  336) 		device_remove_file(&dev->dev, &dev_attr_eject);

---
0-DAY kernel build testing backend         Open Source Technology Centre
Fengguang Wu, Yuanhan Liu                              Intel Corporation

WARNING: multiple messages have this Message-ID (diff)
From: Fengguang Wu <fengguang.wu@intel.com>
To: Lance Ortiz <lance.ortiz@hp.com>
Cc: kernel-janitors@vger.kernel.org, Len Brown <len.brown@intel.com>,
	linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org
Subject: [acpi:next 4/5] drivers/acpi/scan.c:328 acpi_device_remove_files() info: redundant null check on dev->pnp.str_obj calling kfree()
Date: Tue, 2 Oct 2012 15:39:52 +0800	[thread overview]
Message-ID: <20121002073952.GA24180@localhost> (raw)

Hi Lance,

FYI, there are new smatch warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git next
head:   10eaea0474b0078bb84ff9009329b83d3e30337f
commit: 2bc8195d56163f54d3036304efa8d71ab1091bf1 [4/5] ACPI: Add new sysfs interface to export device description

+ drivers/acpi/scan.c:328 acpi_device_remove_files() info: redundant null check on dev->pnp.str_obj calling kfree()

vim +328 drivers/acpi/scan.c

e49bd2dd (Zhang Rui      2006-12-08  312) 		result = device_create_file(&dev->dev, &dev_attr_eject);
0c526d96 (Alex Chiang    2009-05-14  313) end:
e49bd2dd (Zhang Rui      2006-12-08  314) 	return result;
^1da177e (Linus Torvalds 2005-04-16  315) }
^1da177e (Linus Torvalds 2005-04-16  316) 
f883d9db (Patrick Mochel 2006-12-07  317) static void acpi_device_remove_files(struct acpi_device *dev)
^1da177e (Linus Torvalds 2005-04-16  318) {
f883d9db (Patrick Mochel 2006-12-07  319) 	acpi_status status;
f883d9db (Patrick Mochel 2006-12-07  320) 	acpi_handle temp;
^1da177e (Linus Torvalds 2005-04-16  321) 
f883d9db (Patrick Mochel 2006-12-07  322) 	/*
2bc8195d (Lance Ortiz    2012-09-07  323) 	 * If device has _STR, remove 'description' file
2bc8195d (Lance Ortiz    2012-09-07  324) 	 */
2bc8195d (Lance Ortiz    2012-09-07  325) 	status = acpi_get_handle(dev->handle, "_STR", &temp);
2bc8195d (Lance Ortiz    2012-09-07  326) 	if (ACPI_SUCCESS(status)) {
2bc8195d (Lance Ortiz    2012-09-07  327) 		if (dev->pnp.str_obj != NULL)
2bc8195d (Lance Ortiz    2012-09-07 @328) 			kfree(dev->pnp.str_obj);
2bc8195d (Lance Ortiz    2012-09-07  329) 		device_remove_file(&dev->dev, &dev_attr_description);
2bc8195d (Lance Ortiz    2012-09-07  330) 	}
2bc8195d (Lance Ortiz    2012-09-07  331) 	/*
2bc8195d (Lance Ortiz    2012-09-07  332) 	 * If device has _EJ0, remove 'eject' file.
f883d9db (Patrick Mochel 2006-12-07  333) 	 */
f883d9db (Patrick Mochel 2006-12-07  334) 	status = acpi_get_handle(dev->handle, "_EJ0", &temp);
f883d9db (Patrick Mochel 2006-12-07  335) 	if (ACPI_SUCCESS(status))
f883d9db (Patrick Mochel 2006-12-07  336) 		device_remove_file(&dev->dev, &dev_attr_eject);

---
0-DAY kernel build testing backend         Open Source Technology Centre
Fengguang Wu, Yuanhan Liu                              Intel Corporation

             reply	other threads:[~2012-10-02  7:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-02  7:39 Fengguang Wu [this message]
2012-10-02  7:39 ` [acpi:next 4/5] drivers/acpi/scan.c:328 acpi_device_remove_files() info: redundant null check on dev->pnp.str_obj calling kfree() Fengguang Wu
2012-10-02 18:53 ` [acpi:next 4/5] drivers/acpi/scan.c:328 acpi_device_remove_files() info: redundant null check on Ortiz, Lance E
2012-10-02 18:53   ` [acpi:next 4/5] drivers/acpi/scan.c:328 acpi_device_remove_files() info: redundant null check on dev->pnp.str_obj calling kfree() Ortiz, Lance E
2012-10-02 20:46   ` [acpi:next 4/5] drivers/acpi/scan.c:328 acpi_device_remove_files() info: redundant null check on Dan Carpenter
2012-10-02 20:46     ` [acpi:next 4/5] drivers/acpi/scan.c:328 acpi_device_remove_files() info: redundant null check on dev->pnp.str_obj calling kfree() Dan Carpenter

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=20121002073952.GA24180@localhost \
    --to=fengguang.wu@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lance.ortiz@hp.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@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 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.