* [PATCH] ARM: OMAP3+: Fix kernel panic on boot
@ 2013-02-11 20:26 Jon Hunter
2013-02-12 10:07 ` Samuel Ortiz
0 siblings, 1 reply; 3+ messages in thread
From: Jon Hunter @ 2013-02-11 20:26 UTC (permalink / raw)
To: linux-arm-kernel
Commit 8a6aaa3 (mfd: twl-core: Collect global variables behind one
private structure (global)) removed the variable "inuse" that is used
to determine if the device has been initialised and now use the
twl_priv structure instead. This is causing the kernel to panic on
OMAP3+ devices using the twl driver, because we try to access the
twl_priv->ready member before checking if twl_priv is initialised. Fix
this and move this test to the beginning of the twl_i2c_read/write
function because twl_get_last_module() also uses the twl_priv structure.
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/mfd/twl-core.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 557f9ee..89ab4d9 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -316,12 +316,12 @@ int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
int sid;
struct twl_client *twl;
- if (unlikely(mod_no >= twl_get_last_module())) {
- pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
+ if (unlikely(!twl_priv || !twl_priv->ready)) {
+ pr_err("%s: not initialized\n", DRIVER_NAME);
return -EPERM;
}
- if (unlikely(!twl_priv->ready)) {
- pr_err("%s: not initialized\n", DRIVER_NAME);
+ if (unlikely(mod_no >= twl_get_last_module())) {
+ pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
return -EPERM;
}
@@ -355,12 +355,12 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
int sid;
struct twl_client *twl;
- if (unlikely(mod_no >= twl_get_last_module())) {
- pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
+ if (unlikely(!twl_priv || !twl_priv->ready)) {
+ pr_err("%s: not initialized\n", DRIVER_NAME);
return -EPERM;
}
- if (unlikely(!twl_priv->ready)) {
- pr_err("%s: not initialized\n", DRIVER_NAME);
+ if (unlikely(mod_no >= twl_get_last_module())) {
+ pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
return -EPERM;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] ARM: OMAP3+: Fix kernel panic on boot
2013-02-11 20:26 [PATCH] ARM: OMAP3+: Fix kernel panic on boot Jon Hunter
@ 2013-02-12 10:07 ` Samuel Ortiz
2013-02-12 16:15 ` Jon Hunter
0 siblings, 1 reply; 3+ messages in thread
From: Samuel Ortiz @ 2013-02-12 10:07 UTC (permalink / raw)
To: linux-arm-kernel
Hi Jon,
On Mon, Feb 11, 2013 at 02:26:19PM -0600, Jon Hunter wrote:
> Commit 8a6aaa3 (mfd: twl-core: Collect global variables behind one
> private structure (global)) removed the variable "inuse" that is used
> to determine if the device has been initialised and now use the
> twl_priv structure instead. This is causing the kernel to panic on
> OMAP3+ devices using the twl driver, because we try to access the
> twl_priv->ready member before checking if twl_priv is initialised. Fix
> this and move this test to the beginning of the twl_i2c_read/write
> function because twl_get_last_module() also uses the twl_priv structure.
>
> Signed-off-by: Jon Hunter <jon-hunter@ti.com>
> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> drivers/mfd/twl-core.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
Patch applied, thanks.
I fixed the subject as it's codewise not ARM or OMAP3 related, but rather mfd
and twl-core.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ARM: OMAP3+: Fix kernel panic on boot
2013-02-12 10:07 ` Samuel Ortiz
@ 2013-02-12 16:15 ` Jon Hunter
0 siblings, 0 replies; 3+ messages in thread
From: Jon Hunter @ 2013-02-12 16:15 UTC (permalink / raw)
To: linux-arm-kernel
On 02/12/2013 04:07 AM, Samuel Ortiz wrote:
> Hi Jon,
>
> On Mon, Feb 11, 2013 at 02:26:19PM -0600, Jon Hunter wrote:
>> Commit 8a6aaa3 (mfd: twl-core: Collect global variables behind one
>> private structure (global)) removed the variable "inuse" that is used
>> to determine if the device has been initialised and now use the
>> twl_priv structure instead. This is causing the kernel to panic on
>> OMAP3+ devices using the twl driver, because we try to access the
>> twl_priv->ready member before checking if twl_priv is initialised. Fix
>> this and move this test to the beginning of the twl_i2c_read/write
>> function because twl_get_last_module() also uses the twl_priv structure.
>>
>> Signed-off-by: Jon Hunter <jon-hunter@ti.com>
>> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>> ---
>> drivers/mfd/twl-core.c | 16 ++++++++--------
>> 1 file changed, 8 insertions(+), 8 deletions(-)
> Patch applied, thanks.
> I fixed the subject as it's codewise not ARM or OMAP3 related, but rather mfd
> and twl-core.
Good point! Thanks Jon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-12 16:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-11 20:26 [PATCH] ARM: OMAP3+: Fix kernel panic on boot Jon Hunter
2013-02-12 10:07 ` Samuel Ortiz
2013-02-12 16:15 ` Jon Hunter
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).