From: Wolfram Sang <wsa@the-dreams.de>
To: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: Jiang Liu <jiang.liu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
Toshi Kani <toshi.kani-VXdhtT5mjnY@public.gmane.org>,
"Rafael J. Wysocki"
<rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Yinghai Lu <yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [patch] i2c-scmi: remove some bogus NULL checks
Date: Wed, 30 Oct 2013 16:02:58 +0000 [thread overview]
Message-ID: <20131030160257.GF3663@katana> (raw)
In-Reply-To: <20131019084622.GA9312-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]
On Sat, Oct 19, 2013 at 11:46:22AM +0300, Dan Carpenter wrote:
> "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.
Why is that? Can't see it...
>
> 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;
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: Jiang Liu <jiang.liu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
Toshi Kani <toshi.kani-VXdhtT5mjnY@public.gmane.org>,
"Rafael J. Wysocki"
<rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Yinghai Lu <yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [patch] i2c-scmi: remove some bogus NULL checks
Date: Wed, 30 Oct 2013 17:02:58 +0100 [thread overview]
Message-ID: <20131030160257.GF3663@katana> (raw)
In-Reply-To: <20131019084622.GA9312-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1666 bytes --]
On Sat, Oct 19, 2013 at 11:46:22AM +0300, Dan Carpenter wrote:
> "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.
Why is that? Can't see it...
>
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>
> 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;
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-10-30 16:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-19 8:46 [patch] i2c-scmi: remove some bogus NULL checks Dan Carpenter
2013-10-19 8:46 ` Dan Carpenter
[not found] ` <20131019084622.GA9312-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
2013-10-30 16:02 ` Wolfram Sang [this message]
2013-10-30 16:02 ` Wolfram Sang
2013-10-30 16:39 ` Dan Carpenter
2013-10-30 16:39 ` Dan Carpenter
2013-10-31 11:57 ` Wolfram Sang
2013-10-31 11:57 ` Wolfram Sang
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=20131030160257.GF3663@katana \
--to=wsa@the-dreams.de \
--cc=dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=jiang.liu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=toshi.kani-VXdhtT5mjnY@public.gmane.org \
--cc=yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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.