Hi Alexey, Ingo, On Thu, 17 Jul 2008 13:48:58 +0400, Alexey Dobriyan wrote:Analysis is totally correct. I guess I shouldn't have tried to fix the original bug in a hurry before leaving for vacation. I didn't have the time to completely test it and as a result I introduced a new bug. Which the following patch should fix: * * * * * Subject: i2c: Fix oops on bus multiplexer driver loading The two I2C bus multiplexer drivers (i2c-amd756-s4882 and i2c-nforce2-s4985) make use of the bus they want to multiplex before checking if it is really present. Swap the instructions to test for presence first. This fixes a oops reported by Ingo Molnar. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Ingo Molnar <mingo@elte.hu> --- drivers/i2c/busses/i2c-amd756-s4882.c | 9 ++++----- drivers/i2c/busses/i2c-nforce2-s4985.c | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) --- linux-2.6.27-rc2.orig/drivers/i2c/busses/i2c-amd756-s4882.c 2008-08-05 18:17:05.000000000 +0200 +++ linux-2.6.27-rc2/drivers/i2c/busses/i2c-amd756-s4882.c 2008-08-06 20:40:16.000000000 +0200 @@ -155,6 +155,9 @@ static int __init amd756_s4882_init(void int i, error; union i2c_smbus_data ioconfig; + if (!amd756_smbus.dev.parent) + return -ENODEV; + /* Configure the PCA9556 multiplexer */ ioconfig.byte = 0x00; /* All I/O to output mode */ error = i2c_smbus_xfer(&amd756_smbus, 0x18, 0, I2C_SMBUS_WRITE, 0x03, @@ -168,11 +171,7 @@ static int __init amd756_s4882_init(void /* Unregister physical bus */ error = i2c_del_adapter(&amd756_smbus); if (error) { - if (error == -EINVAL) - error = -ENODEV; - else - dev_err(&amd756_smbus.dev, "Physical bus removal " - "failed\n"); + dev_err(&amd756_smbus.dev, "Physical bus removal failed\n"); goto ERROR0; } --- linux-2.6.27-rc2.orig/drivers/i2c/busses/i2c-nforce2-s4985.c 2008-08-05 18:17:05.000000000 +0200 +++ linux-2.6.27-rc2/drivers/i2c/busses/i2c-nforce2-s4985.c 2008-08-06 20:07:48.000000000 +0200 @@ -150,6 +150,9 @@ static int __init nforce2_s4985_init(voi int i, error; union i2c_smbus_data ioconfig; + if (!nforce2_smbus) + return -ENODEV; + /* Configure the PCA9556 multiplexer */ ioconfig.byte = 0x00; /* All I/O to output mode */ error = i2c_smbus_xfer(nforce2_smbus, 0x18, 0, I2C_SMBUS_WRITE, 0x03, @@ -161,8 +164,6 @@ static int __init nforce2_s4985_init(voi } /* Unregister physical bus */ - if (!nforce2_smbus) - return -ENODEV; error = i2c_del_adapter(nforce2_smbus); if (error) { dev_err(&nforce2_smbus->dev, "Physical bus removal failed\n"); This is going to Linus tomorrow. Thanks, -- Jean Delvare --
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Greg Kroah-Hartman | [PATCH 004/196] Chinese: add translation of SubmittingPatches |
| David Miller | Slow DOWN, please!!! |
| Bill Davidsen | Re: [patch] CFS scheduler, -v19 |
| Tomas Winkler | [PATCH] iwlwifi: compilation error when CONFIG_IWLWIFI_DEBUG is not set |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Corey Minyard | Re: [PATCH 3/3] Convert the UDP hash lock to RCU |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
git: | |
