diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-03-09 03:16:46 -0500 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2013-04-02 01:06:03 -0400 |
commit | bf51a8c5e0b6133b929eb7d7456e99a605f8168c (patch) | |
tree | 5b592f4c92618ae074af18afee0ff1ad269177d3 /drivers | |
parent | f5fb0822957b914ab7022cc4bfe000ec3bc9c82c (diff) |
i2c: Ignore return value of i2c_del_adapter()
i2c_del_adapter() always returns 0. So all checks testing whether it will be
non zero will always evaluate to false and the conditional code is dead code.
This patch updates all callers of i2c_del_mux_adapter() to ignore the return
value and assume that it will always succeed (which it will). In a subsequent
patch the return type of i2c_del_adapter() will be made void.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-amd756-s4882.c | 6 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-at91.c | 5 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-cbus-gpio.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-intel-mid.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-mv64xxx.c | 5 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-mxs.c | 5 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-nforce2-s4985.c | 6 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-powermac.c | 10 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-puv3.c | 10 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-viperboard.c | 5 | ||||
-rw-r--r-- | drivers/i2c/i2c-mux.c | 5 | ||||
-rw-r--r-- | drivers/media/pci/bt8xx/bttv-input.c | 6 | ||||
-rw-r--r-- | drivers/media/pci/mantis/mantis_i2c.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/falcon.c | 6 | ||||
-rw-r--r-- | drivers/staging/media/go7007/go7007-driver.c | 7 |
16 files changed, 29 insertions, 61 deletions
diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c b/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c index 88627e3ba1e3..1eb86c79523e 100644 --- a/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c +++ b/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c | |||
@@ -319,8 +319,7 @@ void oaktrail_hdmi_i2c_exit(struct pci_dev *dev) | |||
319 | struct hdmi_i2c_dev *i2c_dev; | 319 | struct hdmi_i2c_dev *i2c_dev; |
320 | 320 | ||
321 | hdmi_dev = pci_get_drvdata(dev); | 321 | hdmi_dev = pci_get_drvdata(dev); |
322 | if (i2c_del_adapter(&oaktrail_hdmi_i2c_adapter)) | 322 | i2c_del_adapter(&oaktrail_hdmi_i2c_adapter); |
323 | DRM_DEBUG_DRIVER("Failed to delete hdmi-i2c adapter\n"); | ||
324 | 323 | ||
325 | i2c_dev = hdmi_dev->i2c_dev; | 324 | i2c_dev = hdmi_dev->i2c_dev; |
326 | kfree(i2c_dev); | 325 | kfree(i2c_dev); |
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c index 378fcb5d5783..07f01ac853ff 100644 --- a/drivers/i2c/busses/i2c-amd756-s4882.c +++ b/drivers/i2c/busses/i2c-amd756-s4882.c | |||
@@ -169,11 +169,7 @@ static int __init amd756_s4882_init(void) | |||
169 | } | 169 | } |
170 | 170 | ||
171 | /* Unregister physical bus */ | 171 | /* Unregister physical bus */ |
172 | error = i2c_del_adapter(&amd756_smbus); | 172 | i2c_del_adapter(&amd756_smbus); |
173 | if (error) { | ||
174 | dev_err(&amd756_smbus.dev, "Physical bus removal failed\n"); | ||
175 | goto ERROR0; | ||
176 | } | ||
177 | 173 | ||
178 | printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4882\n"); | 174 | printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4882\n"); |
179 | /* Define the 5 virtual adapters and algorithms structures */ | 175 | /* Define the 5 virtual adapters and algorithms structures */ |
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 23a1c44be340..2fcd2755233d 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c | |||
@@ -783,12 +783,11 @@ static int at91_twi_probe(struct platform_device *pdev) | |||
783 | static int at91_twi_remove(struct platform_device *pdev) | 783 | static int at91_twi_remove(struct platform_device *pdev) |
784 | { | 784 | { |
785 | struct at91_twi_dev *dev = platform_get_drvdata(pdev); | 785 | struct at91_twi_dev *dev = platform_get_drvdata(pdev); |
786 | int rc; | ||
787 | 786 | ||
788 | rc = i2c_del_adapter(&dev->adapter); | 787 | i2c_del_adapter(&dev->adapter); |
789 | clk_disable_unprepare(dev->clk); | 788 | clk_disable_unprepare(dev->clk); |
790 | 789 | ||
791 | return rc; | 790 | return 0; |
792 | } | 791 | } |
793 | 792 | ||
794 | #ifdef CONFIG_PM | 793 | #ifdef CONFIG_PM |
diff --git a/drivers/i2c/busses/i2c-cbus-gpio.c b/drivers/i2c/busses/i2c-cbus-gpio.c index 98386d659318..1be13ac11dc5 100644 --- a/drivers/i2c/busses/i2c-cbus-gpio.c +++ b/drivers/i2c/busses/i2c-cbus-gpio.c | |||
@@ -206,7 +206,9 @@ static int cbus_i2c_remove(struct platform_device *pdev) | |||
206 | { | 206 | { |
207 | struct i2c_adapter *adapter = platform_get_drvdata(pdev); | 207 | struct i2c_adapter *adapter = platform_get_drvdata(pdev); |
208 | 208 | ||
209 | return i2c_del_adapter(adapter); | 209 | i2c_del_adapter(adapter); |
210 | |||
211 | return 0; | ||
210 | } | 212 | } |
211 | 213 | ||
212 | static int cbus_i2c_probe(struct platform_device *pdev) | 214 | static int cbus_i2c_probe(struct platform_device *pdev) |
diff --git a/drivers/i2c/busses/i2c-intel-mid.c b/drivers/i2c/busses/i2c-intel-mid.c index 323fa018ffd5..0fb659726ffc 100644 --- a/drivers/i2c/busses/i2c-intel-mid.c +++ b/drivers/i2c/busses/i2c-intel-mid.c | |||
@@ -1082,8 +1082,7 @@ static void intel_mid_i2c_remove(struct pci_dev *dev) | |||
1082 | { | 1082 | { |
1083 | struct intel_mid_i2c_private *mrst = pci_get_drvdata(dev); | 1083 | struct intel_mid_i2c_private *mrst = pci_get_drvdata(dev); |
1084 | intel_mid_i2c_disable(&mrst->adap); | 1084 | intel_mid_i2c_disable(&mrst->adap); |
1085 | if (i2c_del_adapter(&mrst->adap)) | 1085 | i2c_del_adapter(&mrst->adap); |
1086 | dev_err(&dev->dev, "Failed to delete i2c adapter"); | ||
1087 | 1086 | ||
1088 | free_irq(dev->irq, mrst); | 1087 | free_irq(dev->irq, mrst); |
1089 | iounmap(mrst->base); | 1088 | iounmap(mrst->base); |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 8b20ef8524ac..3bbd65d35a5e 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -701,9 +701,8 @@ static int | |||
701 | mv64xxx_i2c_remove(struct platform_device *dev) | 701 | mv64xxx_i2c_remove(struct platform_device *dev) |
702 | { | 702 | { |
703 | struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev); | 703 | struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev); |
704 | int rc; | ||
705 | 704 | ||
706 | rc = i2c_del_adapter(&drv_data->adapter); | 705 | i2c_del_adapter(&drv_data->adapter); |
707 | free_irq(drv_data->irq, drv_data); | 706 | free_irq(drv_data->irq, drv_data); |
708 | mv64xxx_i2c_unmap_regs(drv_data); | 707 | mv64xxx_i2c_unmap_regs(drv_data); |
709 | #if defined(CONFIG_HAVE_CLK) | 708 | #if defined(CONFIG_HAVE_CLK) |
@@ -715,7 +714,7 @@ mv64xxx_i2c_remove(struct platform_device *dev) | |||
715 | #endif | 714 | #endif |
716 | kfree(drv_data); | 715 | kfree(drv_data); |
717 | 716 | ||
718 | return rc; | 717 | return 0; |
719 | } | 718 | } |
720 | 719 | ||
721 | static const struct of_device_id mv64xxx_i2c_of_match_table[] = { | 720 | static const struct of_device_id mv64xxx_i2c_of_match_table[] = { |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 120f24646696..804eb6b0a0b8 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -686,11 +686,8 @@ static int mxs_i2c_probe(struct platform_device *pdev) | |||
686 | static int mxs_i2c_remove(struct platform_device *pdev) | 686 | static int mxs_i2c_remove(struct platform_device *pdev) |
687 | { | 687 | { |
688 | struct mxs_i2c_dev *i2c = platform_get_drvdata(pdev); | 688 | struct mxs_i2c_dev *i2c = platform_get_drvdata(pdev); |
689 | int ret; | ||
690 | 689 | ||
691 | ret = i2c_del_adapter(&i2c->adapter); | 690 | i2c_del_adapter(&i2c->adapter); |
692 | if (ret) | ||
693 | return -EBUSY; | ||
694 | 691 | ||
695 | if (i2c->dmach) | 692 | if (i2c->dmach) |
696 | dma_release_channel(i2c->dmach); | 693 | dma_release_channel(i2c->dmach); |
diff --git a/drivers/i2c/busses/i2c-nforce2-s4985.c b/drivers/i2c/busses/i2c-nforce2-s4985.c index 29015eb9ca46..2ca268d6140b 100644 --- a/drivers/i2c/busses/i2c-nforce2-s4985.c +++ b/drivers/i2c/busses/i2c-nforce2-s4985.c | |||
@@ -164,11 +164,7 @@ static int __init nforce2_s4985_init(void) | |||
164 | } | 164 | } |
165 | 165 | ||
166 | /* Unregister physical bus */ | 166 | /* Unregister physical bus */ |
167 | error = i2c_del_adapter(nforce2_smbus); | 167 | i2c_del_adapter(nforce2_smbus); |
168 | if (error) { | ||
169 | dev_err(&nforce2_smbus->dev, "Physical bus removal failed\n"); | ||
170 | goto ERROR0; | ||
171 | } | ||
172 | 168 | ||
173 | printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4985\n"); | 169 | printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4985\n"); |
174 | /* Define the 5 virtual adapters and algorithms structures */ | 170 | /* Define the 5 virtual adapters and algorithms structures */ |
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index da54e673449d..8dc90da1e6e6 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
@@ -213,14 +213,8 @@ static const struct i2c_algorithm i2c_powermac_algorithm = { | |||
213 | static int i2c_powermac_remove(struct platform_device *dev) | 213 | static int i2c_powermac_remove(struct platform_device *dev) |
214 | { | 214 | { |
215 | struct i2c_adapter *adapter = platform_get_drvdata(dev); | 215 | struct i2c_adapter *adapter = platform_get_drvdata(dev); |
216 | int rc; | 216 | |
217 | 217 | i2c_del_adapter(adapter); | |
218 | rc = i2c_del_adapter(adapter); | ||
219 | /* We aren't that prepared to deal with this... */ | ||
220 | if (rc) | ||
221 | printk(KERN_WARNING | ||
222 | "i2c-powermac.c: Failed to remove bus %s !\n", | ||
223 | adapter->name); | ||
224 | memset(adapter, 0, sizeof(*adapter)); | 218 | memset(adapter, 0, sizeof(*adapter)); |
225 | 219 | ||
226 | return 0; | 220 | return 0; |
diff --git a/drivers/i2c/busses/i2c-puv3.c b/drivers/i2c/busses/i2c-puv3.c index 261d7db437e2..4fd47bcd1108 100644 --- a/drivers/i2c/busses/i2c-puv3.c +++ b/drivers/i2c/busses/i2c-puv3.c | |||
@@ -234,21 +234,15 @@ static int puv3_i2c_remove(struct platform_device *pdev) | |||
234 | { | 234 | { |
235 | struct i2c_adapter *adapter = platform_get_drvdata(pdev); | 235 | struct i2c_adapter *adapter = platform_get_drvdata(pdev); |
236 | struct resource *mem; | 236 | struct resource *mem; |
237 | int rc; | ||
238 | 237 | ||
239 | rc = i2c_del_adapter(adapter); | 238 | i2c_del_adapter(adapter); |
240 | if (rc) { | ||
241 | dev_err(&pdev->dev, "Adapter '%s' delete fail\n", | ||
242 | adapter->name); | ||
243 | return rc; | ||
244 | } | ||
245 | 239 | ||
246 | put_device(&pdev->dev); | 240 | put_device(&pdev->dev); |
247 | 241 | ||
248 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 242 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
249 | release_mem_region(mem->start, resource_size(mem)); | 243 | release_mem_region(mem->start, resource_size(mem)); |
250 | 244 | ||
251 | return rc; | 245 | return 0; |
252 | } | 246 | } |
253 | 247 | ||
254 | #ifdef CONFIG_PM | 248 | #ifdef CONFIG_PM |
diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c index f45c32c1ace6..c68450cd8d5f 100644 --- a/drivers/i2c/busses/i2c-viperboard.c +++ b/drivers/i2c/busses/i2c-viperboard.c | |||
@@ -421,11 +421,10 @@ error: | |||
421 | static int vprbrd_i2c_remove(struct platform_device *pdev) | 421 | static int vprbrd_i2c_remove(struct platform_device *pdev) |
422 | { | 422 | { |
423 | struct vprbrd_i2c *vb_i2c = platform_get_drvdata(pdev); | 423 | struct vprbrd_i2c *vb_i2c = platform_get_drvdata(pdev); |
424 | int ret; | ||
425 | 424 | ||
426 | ret = i2c_del_adapter(&vb_i2c->i2c); | 425 | i2c_del_adapter(&vb_i2c->i2c); |
427 | 426 | ||
428 | return ret; | 427 | return 0; |
429 | } | 428 | } |
430 | 429 | ||
431 | static struct platform_driver vprbrd_i2c_driver = { | 430 | static struct platform_driver vprbrd_i2c_driver = { |
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index d94e0ce78277..361b78d76759 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c | |||
@@ -194,11 +194,8 @@ EXPORT_SYMBOL_GPL(i2c_add_mux_adapter); | |||
194 | int i2c_del_mux_adapter(struct i2c_adapter *adap) | 194 | int i2c_del_mux_adapter(struct i2c_adapter *adap) |
195 | { | 195 | { |
196 | struct i2c_mux_priv *priv = adap->algo_data; | 196 | struct i2c_mux_priv *priv = adap->algo_data; |
197 | int ret; | ||
198 | 197 | ||
199 | ret = i2c_del_adapter(adap); | 198 | i2c_del_adapter(adap); |
200 | if (ret < 0) | ||
201 | return ret; | ||
202 | kfree(priv); | 199 | kfree(priv); |
203 | 200 | ||
204 | return 0; | 201 | return 0; |
diff --git a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c index 04207a799055..f42d26d7ed78 100644 --- a/drivers/media/pci/bt8xx/bttv-input.c +++ b/drivers/media/pci/bt8xx/bttv-input.c | |||
@@ -413,10 +413,10 @@ void init_bttv_i2c_ir(struct bttv *btv) | |||
413 | 413 | ||
414 | int fini_bttv_i2c(struct bttv *btv) | 414 | int fini_bttv_i2c(struct bttv *btv) |
415 | { | 415 | { |
416 | if (0 != btv->i2c_rc) | 416 | if (btv->i2c_rc == 0) |
417 | return 0; | 417 | i2c_del_adapter(&btv->c.i2c_adap); |
418 | 418 | ||
419 | return i2c_del_adapter(&btv->c.i2c_adap); | 419 | return 0; |
420 | } | 420 | } |
421 | 421 | ||
422 | int bttv_input_init(struct bttv *btv) | 422 | int bttv_input_init(struct bttv *btv) |
diff --git a/drivers/media/pci/mantis/mantis_i2c.c b/drivers/media/pci/mantis/mantis_i2c.c index 937fb9d50213..895ddba3c0fb 100644 --- a/drivers/media/pci/mantis/mantis_i2c.c +++ b/drivers/media/pci/mantis/mantis_i2c.c | |||
@@ -261,6 +261,8 @@ int mantis_i2c_exit(struct mantis_pci *mantis) | |||
261 | mmwrite((intmask & ~MANTIS_INT_I2CDONE), MANTIS_INT_MASK); | 261 | mmwrite((intmask & ~MANTIS_INT_I2CDONE), MANTIS_INT_MASK); |
262 | 262 | ||
263 | dprintk(MANTIS_DEBUG, 1, "Removing I2C adapter"); | 263 | dprintk(MANTIS_DEBUG, 1, "Removing I2C adapter"); |
264 | return i2c_del_adapter(&mantis->adapter); | 264 | i2c_del_adapter(&mantis->adapter); |
265 | |||
266 | return 0; | ||
265 | } | 267 | } |
266 | EXPORT_SYMBOL_GPL(mantis_i2c_exit); | 268 | EXPORT_SYMBOL_GPL(mantis_i2c_exit); |
diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c index 49bcd196e10d..defed0eda820 100644 --- a/drivers/net/ethernet/sfc/falcon.c +++ b/drivers/net/ethernet/sfc/falcon.c | |||
@@ -1528,7 +1528,7 @@ static int falcon_probe_nic(struct efx_nic *efx) | |||
1528 | return 0; | 1528 | return 0; |
1529 | 1529 | ||
1530 | fail6: | 1530 | fail6: |
1531 | BUG_ON(i2c_del_adapter(&board->i2c_adap)); | 1531 | i2c_del_adapter(&board->i2c_adap); |
1532 | memset(&board->i2c_adap, 0, sizeof(board->i2c_adap)); | 1532 | memset(&board->i2c_adap, 0, sizeof(board->i2c_adap)); |
1533 | fail5: | 1533 | fail5: |
1534 | efx_nic_free_buffer(efx, &efx->irq_status); | 1534 | efx_nic_free_buffer(efx, &efx->irq_status); |
@@ -1665,13 +1665,11 @@ static void falcon_remove_nic(struct efx_nic *efx) | |||
1665 | { | 1665 | { |
1666 | struct falcon_nic_data *nic_data = efx->nic_data; | 1666 | struct falcon_nic_data *nic_data = efx->nic_data; |
1667 | struct falcon_board *board = falcon_board(efx); | 1667 | struct falcon_board *board = falcon_board(efx); |
1668 | int rc; | ||
1669 | 1668 | ||
1670 | board->type->fini(efx); | 1669 | board->type->fini(efx); |
1671 | 1670 | ||
1672 | /* Remove I2C adapter and clear it in preparation for a retry */ | 1671 | /* Remove I2C adapter and clear it in preparation for a retry */ |
1673 | rc = i2c_del_adapter(&board->i2c_adap); | 1672 | i2c_del_adapter(&board->i2c_adap); |
1674 | BUG_ON(rc); | ||
1675 | memset(&board->i2c_adap, 0, sizeof(board->i2c_adap)); | 1673 | memset(&board->i2c_adap, 0, sizeof(board->i2c_adap)); |
1676 | 1674 | ||
1677 | efx_nic_free_buffer(efx, &efx->irq_status); | 1675 | efx_nic_free_buffer(efx, &efx->irq_status); |
diff --git a/drivers/staging/media/go7007/go7007-driver.c b/drivers/staging/media/go7007/go7007-driver.c index 66950916df23..6f83c52a0b52 100644 --- a/drivers/staging/media/go7007/go7007-driver.c +++ b/drivers/staging/media/go7007/go7007-driver.c | |||
@@ -647,11 +647,8 @@ EXPORT_SYMBOL(go7007_alloc); | |||
647 | void go7007_remove(struct go7007 *go) | 647 | void go7007_remove(struct go7007 *go) |
648 | { | 648 | { |
649 | if (go->i2c_adapter_online) { | 649 | if (go->i2c_adapter_online) { |
650 | if (i2c_del_adapter(&go->i2c_adapter) == 0) | 650 | i2c_del_adapter(&go->i2c_adapter); |
651 | go->i2c_adapter_online = 0; | 651 | go->i2c_adapter_online = 0; |
652 | else | ||
653 | v4l2_err(&go->v4l2_dev, | ||
654 | "error removing I2C adapter!\n"); | ||
655 | } | 652 | } |
656 | 653 | ||
657 | if (go->audio_enabled) | 654 | if (go->audio_enabled) |