From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Daniel Baluta <daniel.baluta@intel.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>,
gwendal@chromium.org, beomho.seo@samsung.com,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"octavian.purdila@intel.com" <octavian.purdila@intel.com>
Subject: Re: [RFC PATCH] iio: ak8975: Make sure chipset is always initialized
Date: Sat, 20 Dec 2014 13:26:36 -0800 [thread overview]
Message-ID: <1419110796.2843.6.camel@spandruv-hsb-test> (raw)
In-Reply-To: <CAEnQRZABxH5MuWEnS=RHmQqGUN0QhFTtXxnM1uyrLxvP2a-Rmg@mail.gmail.com>
On Sat, 2014-12-20 at 00:25 +0200, Daniel Baluta wrote:
> On Sat, Dec 20, 2014 at 12:16 AM, Hartmut Knaack <knaack.h@gmx.de> wrote:
> > Daniel Baluta schrieb am 18.12.2014 um 18:16:
> >> When using ACPI, if acpi_match_device fails then chipset enum will be
> >> uninitialized and &ak_def_array[chipset] will point to some bad address.
> >>
I am missing something. You are enumerated over i2c device, which was
created from ACPI PNP resource. There is a valid handle or and the
device has an ACPI companion at the least. If this failing, I have to
check the code for acpi i2c.
Can you check why this check failed? We may have bug in i2c handling.
Thanks,
Srinivas
> >> This fixes the following compilation warning:
> >>
> >> drivers/iio/magnetometer/ak8975.c: In function ‘ak8975_probe’:
> >> drivers/iio/magnetometer/ak8975.c:788:14: warning: ‘chipset’ may be used
> >> uninitialized in this function [-Wmaybe-uninitialized]
> >> data->def =ak_def_array[chipset];
> >>
> >> Reported-by: Octavian Purdila <octavian.purdila@intel.com>
> >> Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
> >> ---
> >> This is a RFC because while I'm pretty sure that chipset should be initialized
> >> with AK_MAX_TYPE in ak8975_match_acpi_device, I am not sure if we can live with
> >> a NULL return value of ak8975_match_acpi_device. Current implementation ignores
> >> return value of ak8975_match_acpi_device.
> > This seems to be the actual problem: these _match_acpi_device functions return
> > NULL on failure, and this should be checked for.
>
> Ok, so this would acceptable?
>
> diff --git a/drivers/iio/magnetometer/ak8975.c
> b/drivers/iio/magnetometer/ak8975.c
> index 0d10a4b..68d99e9 100644
> --- a/drivers/iio/magnetometer/ak8975.c
> +++ b/drivers/iio/magnetometer/ak8975.c
> @@ -776,8 +776,9 @@ static int ak8975_probe(struct i2c_client *client,
> name = id->name;
> } else if (ACPI_HANDLE(&client->dev))
> name = ak8975_match_acpi_device(&client->dev, &chipset);
> - else
> - return -ENOSYS;
> +
> + if (!name)
> + return -ENODEV;
>
>
> I still have some doubts about return code in case of error.
>
> For ak8975 we use -ENOSYS, but for kxcjk-1013 we use -ENODEV.
>
> I will send a patch after we clear this out.
>
> thanks,
> Daniel.
next prev parent reply other threads:[~2014-12-20 21:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-18 17:16 Daniel Baluta
2014-12-19 22:16 ` Hartmut Knaack
2014-12-19 22:25 ` Daniel Baluta
2014-12-20 21:26 ` Srinivas Pandruvada [this message]
2014-12-20 21:29 ` Pandruvada, Srinivas
2014-12-20 21:40 ` Daniel Baluta
2015-01-19 14:40 ` Daniel Baluta
2015-01-19 16:44 ` Pandruvada, Srinivas
2015-01-19 16:49 ` Daniel Baluta
2015-01-19 16:56 ` Pandruvada, Srinivas
2015-01-23 23:38 ` Hartmut Knaack
2015-01-24 0:17 ` Pandruvada, Srinivas
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=1419110796.2843.6.camel@spandruv-hsb-test \
--to=srinivas.pandruvada@linux.intel.com \
--cc=beomho.seo@samsung.com \
--cc=daniel.baluta@intel.com \
--cc=gwendal@chromium.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=octavian.purdila@intel.com \
--cc=pmeerw@pmeerw.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®