linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] i2c-scmi: remove some bogus NULL checks
@ 2013-10-19  8:46 Dan Carpenter
       [not found] ` <20131019084622.GA9312-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
  2013-10-31 11:57 ` Wolfram Sang
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2013-10-19  8:46 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Jiang Liu, Toshi Kani, Rafael J. Wysocki, Yinghai Lu, linux-i2c,
	kernel-janitors

"obj" can't be NULL here.

We already know that "pkg->package.elements" gives us a valid pointer
so the next pointer after that is also non-NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c
index c447e8d..5992355 100644
--- a/drivers/i2c/busses/i2c-scmi.c
+++ b/drivers/i2c/busses/i2c-scmi.c
@@ -223,7 +223,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
 		goto out;
 
 	obj = pkg->package.elements + 1;
-	if (obj == NULL || obj->type != ACPI_TYPE_INTEGER) {
+	if (obj->type != ACPI_TYPE_INTEGER) {
 		ACPI_ERROR((AE_INFO, "Invalid argument type"));
 		result = -EIO;
 		goto out;
@@ -235,7 +235,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
 	case I2C_SMBUS_BYTE:
 	case I2C_SMBUS_BYTE_DATA:
 	case I2C_SMBUS_WORD_DATA:
-		if (obj == NULL || obj->type != ACPI_TYPE_INTEGER) {
+		if (obj->type != ACPI_TYPE_INTEGER) {
 			ACPI_ERROR((AE_INFO, "Invalid argument type"));
 			result = -EIO;
 			goto out;
@@ -246,7 +246,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
 			data->byte = obj->integer.value;
 		break;
 	case I2C_SMBUS_BLOCK_DATA:
-		if (obj == NULL || obj->type != ACPI_TYPE_BUFFER) {
+		if (obj->type != ACPI_TYPE_BUFFER) {
 			ACPI_ERROR((AE_INFO, "Invalid argument type"));
 			result = -EIO;
 			goto out;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-31 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-19  8:46 [patch] i2c-scmi: remove some bogus NULL checks Dan Carpenter
     [not found] ` <20131019084622.GA9312-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
2013-10-30 16:02   ` Wolfram Sang
2013-10-30 16:39     ` Dan Carpenter
2013-10-31 11:57 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).