From 90482e45e4a39ee10b66436c2b3d5d4d88c2f73c Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 11 Nov 2010 14:05:11 -0800 Subject: misc/isl29020: signedness bug in als_sensing_range_store() "ret_val" is supposed to be signed here or the error handling breaks. Also we should check the return value from i2c_smbus_read_byte_data(). Signed-off-by: Dan Carpenter Signed-off-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/misc/isl29020.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/misc') diff --git a/drivers/misc/isl29020.c b/drivers/misc/isl29020.c index 34fe835921c..ca47e628507 100644 --- a/drivers/misc/isl29020.c +++ b/drivers/misc/isl29020.c @@ -87,7 +87,7 @@ static ssize_t als_sensing_range_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); - unsigned int ret_val; + int ret_val; unsigned long val; if (strict_strtoul(buf, 10, &val)) @@ -106,6 +106,8 @@ static ssize_t als_sensing_range_store(struct device *dev, val = 4; ret_val = i2c_smbus_read_byte_data(client, 0x00); + if (ret_val < 0) + return ret_val; ret_val &= 0xFC; /*reset the bit before setting them */ ret_val |= val - 1; -- cgit v1.2.3 From 1093736b3c34319b8f1825a4423414d9cf397d73 Mon Sep 17 00:00:00 2001 From: Vasiliy Kulikov Date: Thu, 11 Nov 2010 14:05:11 -0800 Subject: drivers/misc/apds9802als.c: fix signedness bug i2c_smbus_read_byte_data() may return negative error code. This is not seen to als_sensing_range_store() as the result is stored in unsigned int. Made it signed. Signed-off-by: Vasiliy Kulikov Cc: Hong Liu Cc: Alan Cox Cc: Anantha Narayanan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/misc/apds9802als.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/misc') diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c index f9b91ba8900..0ed09358027 100644 --- a/drivers/misc/apds9802als.c +++ b/drivers/misc/apds9802als.c @@ -123,7 +123,7 @@ static ssize_t als_sensing_range_store(struct device *dev, { struct i2c_client *client = to_i2c_client(dev); struct als_data *data = i2c_get_clientdata(client); - unsigned int ret_val; + int ret_val; unsigned long val; if (strict_strtoul(buf, 10, &val)) -- cgit v1.2.3 From aec04288904a7308f2900926902040e7a69ae2be Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 11 Nov 2010 14:05:13 -0800 Subject: drivers/misc/bh1770glc.c: error handling in bh1770_power_state_store() There was a signedness bug so "ret" was never less than zero and that breaks the error handling. Also in the original code it would overwrite ret and the result is still negative but it's bogus number instead of the correct error code. Signed-off-by: Dan Carpenter Cc: Samu Onkalo Cc: Jonathan Cameron Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/misc/bh1770glc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/misc/bh1770glc.c b/drivers/misc/bh1770glc.c index cee632e645e..d79a972f2c7 100644 --- a/drivers/misc/bh1770glc.c +++ b/drivers/misc/bh1770glc.c @@ -649,7 +649,7 @@ static ssize_t bh1770_power_state_store(struct device *dev, { struct bh1770_chip *chip = dev_get_drvdata(dev); unsigned long value; - size_t ret; + ssize_t ret; if (strict_strtoul(buf, 0, &value)) return -EINVAL; @@ -659,8 +659,12 @@ static ssize_t bh1770_power_state_store(struct device *dev, pm_runtime_get_sync(dev); ret = bh1770_lux_rate(chip, chip->lux_rate_index); - ret |= bh1770_lux_interrupt_control(chip, BH1770_ENABLE); + if (ret < 0) { + pm_runtime_put(dev); + goto leave; + } + ret = bh1770_lux_interrupt_control(chip, BH1770_ENABLE); if (ret < 0) { pm_runtime_put(dev); goto leave; -- cgit v1.2.3 From dc6641be0ea8819ef095fdcefc2b695611999a21 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Mon, 15 Nov 2010 22:40:38 +0100 Subject: i2c: Remove obsolete cleanup for clientdata A few new i2c-drivers came into the kernel which clear the clientdata-pointer on exit. This is obsolete meanwhile, so fix it and hope the word will spread. Signed-off-by: Wolfram Sang Acked-by: Alan Cox Acked-by: Guennadi Liakhovetski Acked-by: Greg Kroah-Hartman Signed-off-by: Jean Delvare --- drivers/misc/apds9802als.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/misc') diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c index 0ed09358027..644d4cd071c 100644 --- a/drivers/misc/apds9802als.c +++ b/drivers/misc/apds9802als.c @@ -251,7 +251,6 @@ static int apds9802als_probe(struct i2c_client *client, return res; als_error1: - i2c_set_clientdata(client, NULL); kfree(data); return res; } -- cgit v1.2.3 From c22c7aeff69796f46ae0fcec141538e28f50b24e Mon Sep 17 00:00:00 2001 From: "Robin@sgi.com" Date: Wed, 24 Nov 2010 12:56:59 -0800 Subject: sgi-xpc: XPC fails to discover partitions with all nasids above 128 UV hardware defines 256 memory protection regions versus the baseline 64 with increasing size for the SN2 ia64. This was overlooked when XPC was modified to accomodate both UV and SN2. Without this patch, a user could reconfigure their existing system and suddenly disable cross-partition communications with no indication of what has gone wrong. It also prevents larger configurations from using cross-partition communication. Signed-off-by: Robin Holt Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/misc/sgi-xp/xpc_partition.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c index d551f09ccb7..6956f7e7d43 100644 --- a/drivers/misc/sgi-xp/xpc_partition.c +++ b/drivers/misc/sgi-xp/xpc_partition.c @@ -439,18 +439,23 @@ xpc_discovery(void) * nodes that can comprise an access protection grouping. The access * protection is in regards to memory, IOI and IPI. */ - max_regions = 64; region_size = xp_region_size; - switch (region_size) { - case 128: - max_regions *= 2; - case 64: - max_regions *= 2; - case 32: - max_regions *= 2; - region_size = 16; - DBUG_ON(!is_shub2()); + if (is_uv()) + max_regions = 256; + else { + max_regions = 64; + + switch (region_size) { + case 128: + max_regions *= 2; + case 64: + max_regions *= 2; + case 32: + max_regions *= 2; + region_size = 16; + DBUG_ON(!is_shub2()); + } } for (region = 0; region < max_regions; region++) { -- cgit v1.2.3 From b38eeaae267e4cd385ababcc2df82f6c46fc8633 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 24 Nov 2010 12:57:14 -0800 Subject: drivers/misc/isl29020.c: remove incorrect kfree in isl29020_remove() struct als_data *data is not used in this driver at all. Also add a missing ">" character for MODULE_AUTHOR. Signed-off-by: Axel Lin Acked-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/misc/isl29020.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/misc/isl29020.c b/drivers/misc/isl29020.c index ca47e628507..307aada5fff 100644 --- a/drivers/misc/isl29020.c +++ b/drivers/misc/isl29020.c @@ -183,9 +183,7 @@ static int isl29020_probe(struct i2c_client *client, static int isl29020_remove(struct i2c_client *client) { - struct als_data *data = i2c_get_clientdata(client); sysfs_remove_group(&client->dev.kobj, &m_als_gr); - kfree(data); return 0; } @@ -245,6 +243,6 @@ static void __exit sensor_isl29020_exit(void) module_init(sensor_isl29020_init); module_exit(sensor_isl29020_exit); -MODULE_AUTHOR("Kalhan Trisal "); MODULE_DESCRIPTION("Intersil isl29020 ALS Driver"); MODULE_LICENSE("GPL v2"); -- cgit v1.2.3