fix up error returns; from 2.5 patch of MMH

* Greg KH <greg@kroah.com> [2003-06-02 10:20:40 -0700]:

> On Sun, Jun 01, 2003 at 10:38:08AM -0400, Mark M. Hoffman wrote:
> > > This patch against 2.5.70 works for me vs. an SMBus adapter.  It needs
> > re-testing against an ISA adapter since my particular chip is SMBus only.
>
> I've applied this and will send it off to Linus in a bit.


Thanks!

This patch fixes the various return values in the w83781d_detect()
error paths.  It also cleans up some formatting here and there.
It should be applied on top of the previous one.

It works for me; same caveat as above w.r.t. ISA.

Regards,

--
Mark M. Hoffman
mhoffman@lightlink.com


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1990 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker committed 2003-08-31 22:31:56 +00:00
1 parent 67047df36e
commit 15490f82f5
1 file changed
+18 -4
+18 -4
View File
@@ -958,7 +958,10 @@ static int w83781d_detect(struct i2c_adapter *adapter, int address,
bank. */
if (kind < 0) {
if (w83781d_read_value(new_client, W83781D_REG_CONFIG) &
0x80) goto ERROR1;
0x80) {
err = -ENODEV;
goto ERROR1;
}
val1 = w83781d_read_value(new_client, W83781D_REG_BANK);
val2 = w83781d_read_value(new_client, W83781D_REG_CHIPMAN);
/* Check for Winbond or Asus ID if in bank 0 */
@@ -966,14 +969,19 @@ static int w83781d_detect(struct i2c_adapter *adapter, int address,
(((!(val1 & 0x80)) && (val2 != 0xa3) && (val2 != 0xc3)
&& (val2 != 0x94))
|| ((val1 & 0x80) && (val2 != 0x5c) && (val2 != 0x12)
&& (val2 != 0x06)))) goto ERROR1;
&& (val2 != 0x06)))) {
goto ERROR1;
err = -ENODEV;
}
/* If Winbond SMBus, check address at 0x48. Asus doesn't support
except maybe (hopefully) for the as99127f rev.2 */
if ((!is_isa) && (((!(val1 & 0x80)) && (val2 == 0xa3)) ||
((val1 & 0x80) && (val2 == 0x5c)))) {
if (w83781d_read_value
(new_client, W83781D_REG_I2C_ADDR) != address)
(new_client, W83781D_REG_I2C_ADDR) != address) {
err = -ENODEV;
goto ERROR1;
}
}
}
@@ -992,8 +1000,10 @@ static int w83781d_detect(struct i2c_adapter *adapter, int address,
vendid = winbond;
else if ((val2 == 0x12) || (val2 == 0x06))
vendid = asus;
else
else {
err = -ENODEV;
goto ERROR1;
}
val1 =
w83781d_read_value(new_client, W83781D_REG_WCHIPID);
if ((val1 == 0x10 || val1 == 0x11) && vendid == winbond)
@@ -1016,6 +1026,7 @@ static int w83781d_detect(struct i2c_adapter *adapter, int address,
(KERN_WARNING "w83781d.o: Ignoring 'force' parameter for unknown chip at"
"adapter %d, address 0x%02x\n",
i2c_adapter_id(adapter), address);
err = -EINVAL;
goto ERROR1;
}
}
@@ -1046,6 +1057,7 @@ static int w83781d_detect(struct i2c_adapter *adapter, int address,
printk(KERN_ERR "w83781d.o: Internal error: unknown kind (%d)?!?",
kind);
#endif
err = -ENODEV;
goto ERROR1;
}
@@ -1079,6 +1091,7 @@ static int w83781d_detect(struct i2c_adapter *adapter, int address,
force_subclients[i] > 0x4f) {
printk(KERN_ERR "w83781d.o: Invalid subclient address %d; must be 0x48-0x4f\n",
force_subclients[i]);
err = -EINVAL;
goto ERROR5;
}
}
@@ -1102,6 +1115,7 @@ static int w83781d_detect(struct i2c_adapter *adapter, int address,
if(data->lm75[0].addr == data->lm75[1].addr) {
printk(KERN_ERR "w83781d.o: Duplicate addresses 0x%x for subclients.\n",
data->lm75[0].addr);
err = -EBUSY;
goto ERROR5;
}
}