All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware()
@ 2012-04-09 20:49 Jesper Juhl
  2012-04-09 20:49 ` [PATCH 01/26] Bluetooth: btmrvl_sdio: remove pointless conditional before release_firmware() Jesper Juhl
                   ` (25 more replies)
  0 siblings, 26 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial

Here's a series of patches that removes redundant tests for a pointer 
being NULL before passing it to release_firmware().

Such checks are redundant since release_firmware() tests for a NULL 
pointer internally.

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 01/26] Bluetooth: btmrvl_sdio: remove pointless conditional before release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
@ 2012-04-09 20:49 ` Jesper Juhl
  2012-04-13 21:36   ` Gustavo Padovan
  2012-04-09 20:49 ` [PATCH 02/26] radeon_cp: Remove unneeded tests for NULL before calling release_firmware() Jesper Juhl
                   ` (24 subsequent siblings)
  25 siblings, 1 reply; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, linux-bluetooth, Johan Hedberg, Gustavo Padovan,
	Marcel Holtmann

release_firmware() deals gracefullt with NULL pointers so there's no
reason to test for one prior to calling the function.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/bluetooth/btmrvl_sdio.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 27b74b0..ed62c7f 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -339,9 +339,7 @@ static int btmrvl_sdio_download_helper(struct btmrvl_sdio_card *card)
 
 done:
 	kfree(tmphlprbuf);
-	if (fw_helper)
-		release_firmware(fw_helper);
-
+	release_firmware(fw_helper);
 	return ret;
 }
 
@@ -484,10 +482,7 @@ static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card *card)
 
 done:
 	kfree(tmpfwbuf);
-
-	if (fw_firmware)
-		release_firmware(fw_firmware);
-
+	release_firmware(fw_firmware);
 	return ret;
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 02/26] radeon_cp: Remove unneeded tests for NULL before calling release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
  2012-04-09 20:49 ` [PATCH 01/26] Bluetooth: btmrvl_sdio: remove pointless conditional before release_firmware() Jesper Juhl
@ 2012-04-09 20:49 ` Jesper Juhl
  2012-04-09 20:50 ` [PATCH 03/26] [media] s2255drv: Remove redundant NULL test before release_firmware() Jesper Juhl
                   ` (23 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, dri-devel, Jon Mason, Paul Gortmaker, Dave Airlie, David Airlie

release_firmware() does its own tests for NULL pointers so there's no
need to explicitly test before calling it.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/gpu/drm/radeon/radeon_cp.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
index 0ebb7d4..ef67e18 100644
--- a/drivers/gpu/drm/radeon/radeon_cp.c
+++ b/drivers/gpu/drm/radeon/radeon_cp.c
@@ -1827,14 +1827,10 @@ void radeon_do_release(struct drm_device * dev)
 			r600_do_cleanup_cp(dev);
 		else
 			radeon_do_cleanup_cp(dev);
-		if (dev_priv->me_fw) {
-			release_firmware(dev_priv->me_fw);
-			dev_priv->me_fw = NULL;
-		}
-		if (dev_priv->pfp_fw) {
-			release_firmware(dev_priv->pfp_fw);
-			dev_priv->pfp_fw = NULL;
-		}
+		release_firmware(dev_priv->me_fw);
+		dev_priv->me_fw = NULL;
+		release_firmware(dev_priv->pfp_fw);
+		dev_priv->pfp_fw = NULL;
 	}
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 03/26] [media] s2255drv: Remove redundant NULL test before release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
  2012-04-09 20:49 ` [PATCH 01/26] Bluetooth: btmrvl_sdio: remove pointless conditional before release_firmware() Jesper Juhl
  2012-04-09 20:49 ` [PATCH 02/26] radeon_cp: Remove unneeded tests for NULL before calling release_firmware() Jesper Juhl
@ 2012-04-09 20:50 ` Jesper Juhl
  2012-04-09 20:50 ` [PATCH 04/26] typhoon: get rid of redundant conditional before all to release_firmware() Jesper Juhl
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, linux-media, Greg Kroah-Hartman, Hans Verkuil,
	Dan Carpenter, Dean Anderson, Mauro Carvalho Chehab

release_firmware() tests for NULL pointers on its own - there's no
reason to do an explicit check before calling the function.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/media/video/s2255drv.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 4894cbb..37845de 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -1826,8 +1826,7 @@ static void s2255_destroy(struct s2255_dev *dev)
 		usb_free_urb(dev->fw_data->fw_urb);
 		dev->fw_data->fw_urb = NULL;
 	}
-	if (dev->fw_data->fw)
-		release_firmware(dev->fw_data->fw);
+	release_firmware(dev->fw_data->fw);
 	kfree(dev->fw_data->pfw_data);
 	kfree(dev->fw_data);
 	/* reset the DSP so firmware can be reloaded next time */
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 04/26] typhoon: get rid of redundant conditional before all to release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (2 preceding siblings ...)
  2012-04-09 20:50 ` [PATCH 03/26] [media] s2255drv: Remove redundant NULL test before release_firmware() Jesper Juhl
@ 2012-04-09 20:50 ` Jesper Juhl
  2012-04-09 21:03   ` David Dillow
  2012-04-09 20:50 ` [PATCH 05/26] tg3: remove redundant NULL test before release_firmware() call Jesper Juhl
                   ` (21 subsequent siblings)
  25 siblings, 1 reply; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, netdev, David Dillow

There's no need to test for a NULL pointer before calling
release_firmware() since the function does that check itself, so
remove the redundant test.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/ethernet/3com/typhoon.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/3com/typhoon.c b/drivers/net/ethernet/3com/typhoon.c
index 1234a14..b153666 100644
--- a/drivers/net/ethernet/3com/typhoon.c
+++ b/drivers/net/ethernet/3com/typhoon.c
@@ -2549,8 +2549,7 @@ typhoon_init(void)
 static void __exit
 typhoon_cleanup(void)
 {
-	if (typhoon_fw)
-		release_firmware(typhoon_fw);
+	release_firmware(typhoon_fw);
 	pci_unregister_driver(&typhoon_driver);
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 05/26] tg3: remove redundant NULL test before release_firmware() call
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (3 preceding siblings ...)
  2012-04-09 20:50 ` [PATCH 04/26] typhoon: get rid of redundant conditional before all to release_firmware() Jesper Juhl
@ 2012-04-09 20:50 ` Jesper Juhl
  2012-04-09 20:50 ` [PATCH 06/26] bna: remove redundant NULL test before release_firmware() Jesper Juhl
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, netdev, Michael Chan, Matt Carlson

There is no need to test for a NULL pointer before calling
release_firmware - the function does that on its own.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/ethernet/broadcom/tg3.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 062ac33..9fbf73e 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -15842,8 +15842,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
 	if (dev) {
 		struct tg3 *tp = netdev_priv(dev);
 
-		if (tp->fw)
-			release_firmware(tp->fw);
+		release_firmware(tp->fw);
 
 		tg3_reset_task_cancel(tp);
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 06/26] bna: remove redundant NULL test before release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (4 preceding siblings ...)
  2012-04-09 20:50 ` [PATCH 05/26] tg3: remove redundant NULL test before release_firmware() call Jesper Juhl
@ 2012-04-09 20:50 ` Jesper Juhl
  2012-04-09 21:14   ` Rasesh Mody
  2012-04-09 20:50 ` [PATCH 07/26] qlogic, netxen: get rid of a redundant test for NULL before call to release_firmware() Jesper Juhl
                   ` (19 subsequent siblings)
  25 siblings, 1 reply; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, netdev, Rasesh Mody

release_firmware() does its own NULL test so explicit test before call
is unneeded.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/ethernet/brocade/bna/bnad.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index ff78f77..d86390c 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -3546,9 +3546,7 @@ static void __exit
 bnad_module_exit(void)
 {
 	pci_unregister_driver(&bnad_pci_driver);
-
-	if (bfi_fw)
-		release_firmware(bfi_fw);
+	release_firmware(bfi_fw);
 }
 
 module_init(bnad_module_init);
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 07/26] qlogic, netxen: get rid of a redundant test for NULL before call to release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (5 preceding siblings ...)
  2012-04-09 20:50 ` [PATCH 06/26] bna: remove redundant NULL test before release_firmware() Jesper Juhl
@ 2012-04-09 20:50 ` Jesper Juhl
  2012-04-09 20:50 ` [PATCH 08/26] qlogic, qlcnic: get rid of redundant test for NULL before a " Jesper Juhl
                   ` (18 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, netdev, Rajesh Borundia, Sony Chacko

Since release_firmware() deals gracefully with being passed a NULL
pointer there is no reason to test explicitly before calling the
function.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
index 718b274..1fb149c 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
@@ -1261,8 +1261,7 @@ next:
 void
 netxen_release_firmware(struct netxen_adapter *adapter)
 {
-	if (adapter->fw)
-		release_firmware(adapter->fw);
+	release_firmware(adapter->fw);
 	adapter->fw = NULL;
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 08/26] qlogic, qlcnic: get rid of redundant test for NULL before a call to release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (6 preceding siblings ...)
  2012-04-09 20:50 ` [PATCH 07/26] qlogic, netxen: get rid of a redundant test for NULL before call to release_firmware() Jesper Juhl
@ 2012-04-09 20:50 ` Jesper Juhl
  2012-04-09 20:50 ` [PATCH 09/26] tehuti: delete redundant NULL check before release_firmware() Jesper Juhl
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, netdev, linux-driver, Sony Chacko, Anirban Chakraborty

Since release_firmware() deals gracefully with being passed a NULL
pointer there's no reason to test explicitly before calling the
function.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
index d32cf0d..799fd40 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
@@ -1321,8 +1321,7 @@ next:
 void
 qlcnic_release_firmware(struct qlcnic_adapter *adapter)
 {
-	if (adapter->fw)
-		release_firmware(adapter->fw);
+	release_firmware(adapter->fw);
 	adapter->fw = NULL;
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 09/26] tehuti: delete redundant NULL check before release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (7 preceding siblings ...)
  2012-04-09 20:50 ` [PATCH 08/26] qlogic, qlcnic: get rid of redundant test for NULL before a " Jesper Juhl
@ 2012-04-09 20:50 ` Jesper Juhl
  2012-04-11 13:31   ` Andy Gospodarek
  2012-04-09 20:50 ` [PATCH 10/26] wireless, at76c50x:: Don't needlessly test for NULL before calling release_firmware() Jesper Juhl
                   ` (16 subsequent siblings)
  25 siblings, 1 reply; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, netdev, Andy Gospodarek

release_firmware() checks for NULL pointers - no need to test before
the call.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/ethernet/tehuti/tehuti.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c
index ad973ff..a445e77 100644
--- a/drivers/net/ethernet/tehuti/tehuti.c
+++ b/drivers/net/ethernet/tehuti/tehuti.c
@@ -341,8 +341,8 @@ static int bdx_fw_load(struct bdx_priv *priv)
 out:
 	if (master)
 		WRITE_REG(priv, regINIT_SEMAPHORE, 1);
-	if (fw)
-		release_firmware(fw);
+
+	release_firmware(fw);
 
 	if (rc) {
 		netdev_err(priv->ndev, "firmware loading failed\n");
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 10/26] wireless, at76c50x:: Don't needlessly test for NULL before calling release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (8 preceding siblings ...)
  2012-04-09 20:50 ` [PATCH 09/26] tehuti: delete redundant NULL check before release_firmware() Jesper Juhl
@ 2012-04-09 20:50 ` Jesper Juhl
  2012-04-09 20:50   ` Jesper Juhl
                   ` (15 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, netdev, linux-wireless, John W. Linville

The release_firmware() function deals gracefully with being passed a
NULL pointer, so explicit tests before the call are rather pointless.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/wireless/at76c50x-usb.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index 4045e5a..faa8bcb 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -2512,10 +2512,8 @@ static void __exit at76_mod_exit(void)
 
 	printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION " unloading\n");
 	usb_deregister(&at76_driver);
-	for (i = 0; i < ARRAY_SIZE(firmwares); i++) {
-		if (firmwares[i].fw)
-			release_firmware(firmwares[i].fw);
-	}
+	for (i = 0; i < ARRAY_SIZE(firmwares); i++)
+		release_firmware(firmwares[i].fw);
 	led_trigger_unregister_simple(ledtrig_tx);
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 11/26] wireless, atmel: remove pointless test for NULL before release_firmware() call
@ 2012-04-09 20:50   ` Jesper Juhl
  0 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, netdev, linux-wireless, John W. Linville, Simon Kelley

release_firmware() does its own test. Explicitly checking before the
call is redundant.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/wireless/atmel.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 6c87a82..d07c030 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -3989,8 +3989,7 @@ static int reset_atmel_card(struct net_device *dev)
 			atmel_copy_to_card(priv->dev, 0x8000, &fw[0x6000], len - 0x6000);
 		}
 
-		if (fw_entry)
-			release_firmware(fw_entry);
+		release_firmware(fw_entry);
 	}
 
 	err = atmel_wakeup_firmware(priv);
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 11/26] wireless, atmel: remove pointless test for NULL before release_firmware() call
@ 2012-04-09 20:50   ` Jesper Juhl
  0 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:50 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: trivial-DgEjT+Ai2ygdnm+yROfE0A, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, John W. Linville,
	Simon Kelley

release_firmware() does its own test. Explicitly checking before the
call is redundant.

Signed-off-by: Jesper Juhl <jj-IYz4IdjRLj0sV2N9l4h3zg@public.gmane.org>
---
 drivers/net/wireless/atmel.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 6c87a82..d07c030 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -3989,8 +3989,7 @@ static int reset_atmel_card(struct net_device *dev)
 			atmel_copy_to_card(priv->dev, 0x8000, &fw[0x6000], len - 0x6000);
 		}
 
-		if (fw_entry)
-			release_firmware(fw_entry);
+		release_firmware(fw_entry);
 	}
 
 	err = atmel_wakeup_firmware(priv);
-- 
1.7.10


-- 
Jesper Juhl <jj-IYz4IdjRLj0sV2N9l4h3zg@public.gmane.org>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 12/26] ipw2200: remove a redundant NULL check before calling release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (10 preceding siblings ...)
  2012-04-09 20:50   ` Jesper Juhl
@ 2012-04-09 20:51 ` Jesper Juhl
  2012-04-09 20:51 ` [PATCH 13/26] wireless, libertas: remove redundant NULL tests " Jesper Juhl
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, netdev, linux-wireless, John W. Linville, Stanislav Yakovlev

The release_firmware() function does its own NULL test, so testing
before calling it is rather redundant.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/wireless/ipw2x00/ipw2200.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 2b02257..77c5d2f 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -3657,8 +3657,7 @@ static int ipw_load(struct ipw_priv *priv)
 		priv->rxq = NULL;
 	}
 	ipw_tx_queue_free(priv);
-	if (raw)
-		release_firmware(raw);
+	release_firmware(raw);
 #ifdef CONFIG_PM
 	fw_loaded = 0;
 	raw = NULL;
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 13/26] wireless, libertas: remove redundant NULL tests before calling release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (11 preceding siblings ...)
  2012-04-09 20:51 ` [PATCH 12/26] ipw2200: remove a redundant NULL check before calling release_firmware() Jesper Juhl
@ 2012-04-09 20:51 ` Jesper Juhl
  2012-04-09 20:51 ` [PATCH 14/26] wireless, mwifiex: drop redundant NULL test before call to release_firmware() Jesper Juhl
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, netdev, linux-wireless, libertas-dev, John W. Linville,
	Dan Williams

release_firmware() tests for, and deals gracefully with, NULL
pointers. Remove redundant explicit tests before calling the function.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/wireless/libertas/if_cs.c   |    6 ++----
 drivers/net/wireless/libertas/if_sdio.c |    6 ++----
 drivers/net/wireless/libertas/if_spi.c  |    6 ++----
 drivers/net/wireless/libertas/main.c    |   12 ++++--------
 4 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 234ee88..171a06b 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -951,10 +951,8 @@ out2:
 out1:
 	pcmcia_disable_device(p_dev);
 out:
-	if (helper)
-		release_firmware(helper);
-	if (mainfw)
-		release_firmware(mainfw);
+	release_firmware(helper);
+	release_firmware(mainfw);
 
 	lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);
 	return ret;
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index 9804ebc..15bfe2f 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -751,10 +751,8 @@ success:
 	ret = 0;
 
 out:
-	if (helper)
-		release_firmware(helper);
-	if (mainfw)
-		release_firmware(mainfw);
+	release_firmware(helper);
+	release_firmware(mainfw);
 
 	lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
 	return ret;
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 50b1ee7..7a5df4f 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1095,10 +1095,8 @@ static int if_spi_init_card(struct if_spi_card *card)
 		goto out;
 
 out:
-	if (helper)
-		release_firmware(helper);
-	if (mainfw)
-		release_firmware(mainfw);
+	release_firmware(helper);
+	release_firmware(mainfw);
 
 	lbs_deb_leave_args(LBS_DEB_SPI, "err %d\n", err);
 
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 957681d..3b81b70 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -1269,14 +1269,10 @@ int lbs_get_firmware(struct device *dev, const char *user_helper,
 
   fail:
 	/* Failed */
-	if (*helper) {
-		release_firmware(*helper);
-		*helper = NULL;
-	}
-	if (*mainfw) {
-		release_firmware(*mainfw);
-		*mainfw = NULL;
-	}
+	release_firmware(*helper);
+	*helper = NULL;
+	release_firmware(*mainfw);
+	*mainfw = NULL;
 
 	return -ENOENT;
 }
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 14/26] wireless, mwifiex: drop redundant NULL test before call to release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (12 preceding siblings ...)
  2012-04-09 20:51 ` [PATCH 13/26] wireless, libertas: remove redundant NULL tests " Jesper Juhl
@ 2012-04-09 20:51 ` Jesper Juhl
  2012-04-09 20:59   ` Bing Zhao
  2012-04-09 20:51 ` [PATCH 15/26] wireless, orinoco: release_firmware() tests for NULL, remove explicit tests before calls Jesper Juhl
                   ` (11 subsequent siblings)
  25 siblings, 1 reply; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, netdev, linux-wireless, John W. Linville, Bing Zhao

Since release_firmware() does its own test for NULL it is redundant to
do so before calling it.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/wireless/mwifiex/main.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 9d1b3ca..2ee6162 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -342,8 +342,7 @@ static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter)
 	ret = 0;
 
 done:
-	if (adapter->firmware)
-		release_firmware(adapter->firmware);
+	release_firmware(adapter->firmware);
 	if (ret)
 		ret = -1;
 	return ret;
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 15/26] wireless, orinoco: release_firmware() tests for NULL, remove explicit tests before calls
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (13 preceding siblings ...)
  2012-04-09 20:51 ` [PATCH 14/26] wireless, mwifiex: drop redundant NULL test before call to release_firmware() Jesper Juhl
@ 2012-04-09 20:51 ` Jesper Juhl
  2012-04-09 20:51 ` [PATCH 16/26] remoteproc: remove redundant NULL check before release_firmware() Jesper Juhl
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, netdev, linux-wireless, Pavel Roskin, Paul Gortmaker,
	John W. Linville

It is redundant to test for NULL pointers before calling
release_firmware() since the function does its own NULL test.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/wireless/orinoco/fw.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/orinoco/fw.c b/drivers/net/wireless/orinoco/fw.c
index 4df8cf6..400a352 100644
--- a/drivers/net/wireless/orinoco/fw.c
+++ b/drivers/net/wireless/orinoco/fw.c
@@ -379,11 +379,8 @@ void orinoco_cache_fw(struct orinoco_private *priv, int ap)
 
 void orinoco_uncache_fw(struct orinoco_private *priv)
 {
-	if (priv->cached_pri_fw)
-		release_firmware(priv->cached_pri_fw);
-	if (priv->cached_fw)
-		release_firmware(priv->cached_fw);
-
+	release_firmware(priv->cached_pri_fw);
+	release_firmware(priv->cached_fw);
 	priv->cached_pri_fw = NULL;
 	priv->cached_fw = NULL;
 }
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 16/26] remoteproc: remove redundant NULL check before release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (14 preceding siblings ...)
  2012-04-09 20:51 ` [PATCH 15/26] wireless, orinoco: release_firmware() tests for NULL, remove explicit tests before calls Jesper Juhl
@ 2012-04-09 20:51 ` Jesper Juhl
  2012-04-09 20:51 ` [PATCH 17/26] [SCSI] aic94xx: Get rid of redundant NULL check before release_firmware() call Jesper Juhl
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, Ohad Ben-Cohen

release_firmware deals gracefully with NULL pointers, so checking
first is redundant.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/remoteproc/remoteproc_core.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index ee15c68..3d2884b 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1105,8 +1105,7 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context)
 		goto out;
 
 out:
-	if (fw)
-		release_firmware(fw);
+	release_firmware(fw);
 	/* allow rproc_unregister() contexts, if any, to proceed */
 	complete_all(&rproc->firmware_loading_complete);
 }
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 17/26] [SCSI] aic94xx: Get rid of redundant NULL check before release_firmware() call
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (15 preceding siblings ...)
  2012-04-09 20:51 ` [PATCH 16/26] remoteproc: remove redundant NULL check before release_firmware() Jesper Juhl
@ 2012-04-09 20:51 ` Jesper Juhl
  2012-04-09 20:51 ` [PATCH 18/26] [SCSI] qla1280: Remove " Jesper Juhl
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, linux-scsi, James E.J. Bottomley

release_firmware() checks for NULL pointers internally, so checking
before calling the function is redundant.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/scsi/aic94xx/aic94xx_seq.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/aic94xx/aic94xx_seq.c b/drivers/scsi/aic94xx/aic94xx_seq.c
index 390168f..5fdca93 100644
--- a/drivers/scsi/aic94xx/aic94xx_seq.c
+++ b/drivers/scsi/aic94xx/aic94xx_seq.c
@@ -1228,8 +1228,7 @@ static int asd_seq_start_lseq(struct asd_ha_struct *asd_ha, int lseq)
 
 int asd_release_firmware(void)
 {
-	if (sequencer_fw)
-		release_firmware(sequencer_fw);
+	release_firmware(sequencer_fw);
 	return 0;
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 18/26] [SCSI] qla1280: Remove redundant NULL check before release_firmware() call
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (16 preceding siblings ...)
  2012-04-09 20:51 ` [PATCH 17/26] [SCSI] aic94xx: Get rid of redundant NULL check before release_firmware() call Jesper Juhl
@ 2012-04-09 20:51 ` Jesper Juhl
  2012-04-09 20:51 ` [PATCH 19/26] [SCSI] qla2xxx: " Jesper Juhl
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, linux-scsi, James E.J. Bottomley, Michael Reed

release_firmware() checks for NULL pointers internally so checking
before calling the function is redundant.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/scsi/qla1280.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 6c6486f..538230b 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -4473,17 +4473,14 @@ qla1280_exit(void)
 	pci_unregister_driver(&qla1280_pci_driver);
 	/* release any allocated firmware images */
 	for (i = 0; i < QL_NUM_FW_IMAGES; i++) {
-		if (qla1280_fw_tbl[i].fw) {
-			release_firmware(qla1280_fw_tbl[i].fw);
-			qla1280_fw_tbl[i].fw = NULL;
-		}
+		release_firmware(qla1280_fw_tbl[i].fw);
+		qla1280_fw_tbl[i].fw = NULL;
 	}
 }
 
 module_init(qla1280_init);
 module_exit(qla1280_exit);
 
-
 MODULE_AUTHOR("Qlogic & Jes Sorensen");
 MODULE_DESCRIPTION("Qlogic ISP SCSI (qla1x80/qla1x160) driver");
 MODULE_LICENSE("GPL");
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 19/26] [SCSI] qla2xxx: Remove redundant NULL check before release_firmware() call.
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (17 preceding siblings ...)
  2012-04-09 20:51 ` [PATCH 18/26] [SCSI] qla1280: Remove " Jesper Juhl
@ 2012-04-09 20:51 ` Jesper Juhl
  2012-04-10 12:22   ` Chad Dupuis
  2012-04-09 20:51 ` [PATCH 20/26] [media] staging: as102: Remove redundant NULL check before release_firmware() and pointless comments Jesper Juhl
                   ` (6 subsequent siblings)
  25 siblings, 1 reply; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, linux-scsi, James E.J. Bottomley, linux-driver, Andrew Vasquez

release_firmware() checks for NULL pointers internally so checking
before calling it is redundant.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/scsi/qla2xxx/qla_os.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index a2f9992..91b6fe6 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4106,8 +4106,7 @@ qla2x00_release_firmware(void)
 
 	mutex_lock(&qla_fw_lock);
 	for (idx = 0; idx < FW_BLOBS; idx++)
-		if (qla_fw_blobs[idx].fw)
-			release_firmware(qla_fw_blobs[idx].fw);
+		release_firmware(qla_fw_blobs[idx].fw);
 	mutex_unlock(&qla_fw_lock);
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 20/26] [media] staging: as102: Remove redundant NULL check before release_firmware() and pointless comments
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (18 preceding siblings ...)
  2012-04-09 20:51 ` [PATCH 19/26] [SCSI] qla2xxx: " Jesper Juhl
@ 2012-04-09 20:51 ` Jesper Juhl
  2012-04-09 20:51 ` [PATCH 21/26] staging: vt6656: Don't needlessly test for NULL before release_firmware() Jesper Juhl
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, devel, linux-media, Pierrick Hascoet, Devin Heitmueller,
	Piotr Chmura, Sylwester Nawrocki, Greg Kroah-Hartman,
	Mauro Carvalho Chehab

release_firmware() deals gracefullt with NULL pointers - it's
redundant to check for them before calling the function.

Also remove a few pointless comments - it's rather obvious from the
code that kfree() free's a buffer and that release_firmware() releases
firmware - comments just stating that add no value.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/staging/media/as102/as102_fw.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/media/as102/as102_fw.c b/drivers/staging/media/as102/as102_fw.c
index 43ebc43..9db275e 100644
--- a/drivers/staging/media/as102/as102_fw.c
+++ b/drivers/staging/media/as102/as102_fw.c
@@ -230,11 +230,8 @@ int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap)
 	pr_info("%s: firmware: %s loaded with success\n",
 		DRIVER_NAME, fw2);
 error:
-	/* free data buffer */
 	kfree(cmd_buf);
-	/* release firmware if needed */
-	if (firmware != NULL)
-		release_firmware(firmware);
+	release_firmware(firmware);
 
 	LEAVE();
 	return errno;
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 21/26] staging: vt6656: Don't needlessly test for NULL before release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (19 preceding siblings ...)
  2012-04-09 20:51 ` [PATCH 20/26] [media] staging: as102: Remove redundant NULL check before release_firmware() and pointless comments Jesper Juhl
@ 2012-04-09 20:51 ` Jesper Juhl
  2012-04-09 20:52 ` [PATCH 22/26] usb/storage/ene_ub6250: Remove redundant NULL check before release_firmware() and pointless assignment Jesper Juhl
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, devel, Jiri Pirko, Julia Lawall, David S. Miller,
	Marcos Paulo de Souza, Greg Kroah-Hartman, Forest Bond

Checking for a NULL pointer before calling release_firmware() is
redundant since the function does that check itself.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/staging/vt6656/main_usb.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 763e028..ee5261a 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -1257,9 +1257,7 @@ static void __devexit vt6656_disconnect(struct usb_interface *intf)
 	}
 
 	device_release_WPADEV(device);
-
-	if (device->firmware)
-		release_firmware(device->firmware);
+	release_firmware(device->firmware);
 
 	usb_set_intfdata(intf, NULL);
 	usb_put_dev(interface_to_usbdev(intf));
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 22/26] usb/storage/ene_ub6250: Remove redundant NULL check before release_firmware() and pointless assignment
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (20 preceding siblings ...)
  2012-04-09 20:51 ` [PATCH 21/26] staging: vt6656: Don't needlessly test for NULL before release_firmware() Jesper Juhl
@ 2012-04-09 20:52 ` Jesper Juhl
  2012-04-09 20:52   ` Jesper Juhl
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, usb-storage, linux-usb, Greg Kroah-Hartman, Matthew Dharm

release_firmware() tests for a NULL pointer, so it's redundant to do
that checking before calling it.

Additionally, in ene_load_bincode(), 'sd_fw' is a local variable so
setting it to NULL just before it goes out of scope is completely
pointless, so remove that assignment.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/usb/storage/ene_ub6250.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
index e7e6781..b28f2ad 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -1933,11 +1933,7 @@ static int ene_load_bincode(struct us_data *us, unsigned char flag)
 	kfree(buf);
 
 nofw:
-	if (sd_fw != NULL) {
-		release_firmware(sd_fw);
-		sd_fw = NULL;
-	}
-
+	release_firmware(sd_fw);
 	return result;
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 23/26] ALSA: riptide: remove redundant NULL test before release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
@ 2012-04-09 20:52   ` Jesper Juhl
  2012-04-09 20:49 ` [PATCH 02/26] radeon_cp: Remove unneeded tests for NULL before calling release_firmware() Jesper Juhl
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, alsa-devel, Clemens Ladisch, Rusty Russell,
	Paul Gortmaker, Takashi Iwai, Jaroslav Kysela

release_firmware() deals gracefully with NULL pointers, no need to check first.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 sound/pci/riptide/riptide.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 0481d94..cbeb3f7 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1837,8 +1837,7 @@ static int snd_riptide_free(struct snd_riptide *chip)
 	}
 	if (chip->irq >= 0)
 		free_irq(chip->irq, chip);
-	if (chip->fw_entry)
-		release_firmware(chip->fw_entry);
+	release_firmware(chip->fw_entry);
 	release_and_free_resource(chip->res_port);
 	kfree(chip);
 	return 0;
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 23/26] ALSA: riptide: remove redundant NULL test before release_firmware()
@ 2012-04-09 20:52   ` Jesper Juhl
  0 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: alsa-devel, trivial, Takashi Iwai, Rusty Russell,
	Clemens Ladisch, Paul Gortmaker

release_firmware() deals gracefully with NULL pointers, no need to check first.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 sound/pci/riptide/riptide.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 0481d94..cbeb3f7 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1837,8 +1837,7 @@ static int snd_riptide_free(struct snd_riptide *chip)
 	}
 	if (chip->irq >= 0)
 		free_irq(chip->irq, chip);
-	if (chip->fw_entry)
-		release_firmware(chip->fw_entry);
+	release_firmware(chip->fw_entry);
 	release_and_free_resource(chip->res_port);
 	kfree(chip);
 	return 0;
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 24/26] ASoC: wm8994: Don't test for NULL before release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
@ 2012-04-09 20:52   ` Jesper Juhl
  2012-04-09 20:49 ` [PATCH 02/26] radeon_cp: Remove unneeded tests for NULL before calling release_firmware() Jesper Juhl
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, alsa-devel, Takashi Iwai, Jaroslav Kysela,
	Liam Girdwood, Dimitris Papastamos, Ian Lartey, Mark Brown

release_firmware() does its own NULL ptr testing, it's redundant to
also test before calling it.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 sound/soc/codecs/wm8994.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 7c49642..cf7e5d2 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3972,7 +3972,7 @@ err_irq:
 	return ret;
 }
 
-static int  wm8994_codec_remove(struct snd_soc_codec *codec)
+static int wm8994_codec_remove(struct snd_soc_codec *codec)
 {
 	struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
 	struct wm8994 *control = wm8994->wm8994;
@@ -4013,14 +4013,10 @@ static int  wm8994_codec_remove(struct snd_soc_codec *codec)
 			free_irq(wm8994->micdet_irq, wm8994);
 		break;
 	}
-	if (wm8994->mbc)
-		release_firmware(wm8994->mbc);
-	if (wm8994->mbc_vss)
-		release_firmware(wm8994->mbc_vss);
-	if (wm8994->enh_eq)
-		release_firmware(wm8994->enh_eq);
+	release_firmware(wm8994->mbc);
+	release_firmware(wm8994->mbc_vss);
+	release_firmware(wm8994->enh_eq);
 	kfree(wm8994->retune_mobile_texts);
-
 	return 0;
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 24/26] ASoC: wm8994: Don't test for NULL before release_firmware()
@ 2012-04-09 20:52   ` Jesper Juhl
  0 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dimitris Papastamos, alsa-devel, trivial, Takashi Iwai,
	Mark Brown, Ian Lartey, Liam Girdwood

release_firmware() does its own NULL ptr testing, it's redundant to
also test before calling it.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 sound/soc/codecs/wm8994.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 7c49642..cf7e5d2 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3972,7 +3972,7 @@ err_irq:
 	return ret;
 }
 
-static int  wm8994_codec_remove(struct snd_soc_codec *codec)
+static int wm8994_codec_remove(struct snd_soc_codec *codec)
 {
 	struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
 	struct wm8994 *control = wm8994->wm8994;
@@ -4013,14 +4013,10 @@ static int  wm8994_codec_remove(struct snd_soc_codec *codec)
 			free_irq(wm8994->micdet_irq, wm8994);
 		break;
 	}
-	if (wm8994->mbc)
-		release_firmware(wm8994->mbc);
-	if (wm8994->mbc_vss)
-		release_firmware(wm8994->mbc_vss);
-	if (wm8994->enh_eq)
-		release_firmware(wm8994->enh_eq);
+	release_firmware(wm8994->mbc);
+	release_firmware(wm8994->mbc_vss);
+	release_firmware(wm8994->enh_eq);
 	kfree(wm8994->retune_mobile_texts);
-
 	return 0;
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 25/26] usb/atm/ueagle-atm: Don't test for NULL ptr before calling release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (23 preceding siblings ...)
  2012-04-09 20:52   ` Jesper Juhl
@ 2012-04-09 20:52 ` Jesper Juhl
  2012-04-09 20:52 ` [PATCH 26/26] ipw2100: remove a redundant NULL check " Jesper Juhl
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, linux-usb, Greg Kroah-Hartman, Stanislaw Gruszka,
	Matthieu CASTET

release_firmware() deals gracefullt w/ NULL pointers, no need to check
first.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/usb/atm/ueagle-atm.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 01ea5d7..d7e422d 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -1357,10 +1357,8 @@ static int uea_stat_e1(struct uea_softc *sc)
 		/* release the dsp firmware as it is not needed until
 		 * the next failure
 		 */
-		if (sc->dsp_firm) {
-			release_firmware(sc->dsp_firm);
-			sc->dsp_firm = NULL;
-		}
+		release_firmware(sc->dsp_firm);
+		sc->dsp_firm = NULL;
 	}
 
 	/* always update it as atm layer could not be init when we switch to
@@ -1496,10 +1494,8 @@ static int uea_stat_e4(struct uea_softc *sc)
 		/* release the dsp firmware as it is not needed until
 		 * the next failure
 		 */
-		if (sc->dsp_firm) {
-			release_firmware(sc->dsp_firm);
-			sc->dsp_firm = NULL;
-		}
+		release_firmware(sc->dsp_firm);
+		sc->dsp_firm = NULL;
 	}
 
 	/* always update it as atm layer could not be init when we switch to
@@ -2240,8 +2236,7 @@ static void uea_stop(struct uea_softc *sc)
 	/* flush the work item, when no one can schedule it */
 	flush_work_sync(&sc->task);
 
-	if (sc->dsp_firm)
-		release_firmware(sc->dsp_firm);
+	release_firmware(sc->dsp_firm);
 	uea_leaves(INS_TO_USBDEV(sc));
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 26/26] ipw2100: remove a redundant NULL check before calling release_firmware()
  2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
                   ` (24 preceding siblings ...)
  2012-04-09 20:52 ` [PATCH 25/26] usb/atm/ueagle-atm: Don't test for NULL ptr before calling release_firmware() Jesper Juhl
@ 2012-04-09 20:52 ` Jesper Juhl
  25 siblings, 0 replies; 40+ messages in thread
From: Jesper Juhl @ 2012-04-09 20:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: trivial, netdev, linux-wireless, John W. Linville, Stanislav Yakovlev

The release_firmware() function does its own NULL test so a test
before calling it is rather redundant.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/wireless/ipw2x00/ipw2100.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index f0551f8..d8d804e 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -8508,8 +8508,7 @@ static void ipw2100_release_firmware(struct ipw2100_priv *priv,
 				     struct ipw2100_fw *fw)
 {
 	fw->version = 0;
-	if (fw->fw_entry)
-		release_firmware(fw->fw_entry);
+	release_firmware(fw->fw_entry);
 	fw->fw_entry = NULL;
 }
 
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* RE: [PATCH 14/26] wireless, mwifiex: drop redundant NULL test before call to release_firmware()
  2012-04-09 20:51 ` [PATCH 14/26] wireless, mwifiex: drop redundant NULL test before call to release_firmware() Jesper Juhl
@ 2012-04-09 20:59   ` Bing Zhao
  0 siblings, 0 replies; 40+ messages in thread
From: Bing Zhao @ 2012-04-09 20:59 UTC (permalink / raw)
  To: Jesper Juhl, linux-kernel
  Cc: trivial, netdev, linux-wireless, John W. Linville

Hi Jesper,

Thanks for the patch.

> Since release_firmware() does its own test for NULL it is redundant to
> do so before calling it.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Acked-by: Bing Zhao <bzhao@marvell.com>

Thanks,
Bing

> ---
>  drivers/net/wireless/mwifiex/main.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
> index 9d1b3ca..2ee6162 100644
> --- a/drivers/net/wireless/mwifiex/main.c
> +++ b/drivers/net/wireless/mwifiex/main.c
> @@ -342,8 +342,7 @@ static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter)
>  	ret = 0;
> 
>  done:
> -	if (adapter->firmware)
> -		release_firmware(adapter->firmware);
> +	release_firmware(adapter->firmware);
>  	if (ret)
>  		ret = -1;
>  	return ret;
> --
> 1.7.10
> 
> 
> --
> Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
> Don't top-post http://www.catb.org/jargon/html/T/top-post.html
> Plain text mails only, please.


^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 04/26] typhoon: get rid of redundant conditional before all to release_firmware()
  2012-04-09 20:50 ` [PATCH 04/26] typhoon: get rid of redundant conditional before all to release_firmware() Jesper Juhl
@ 2012-04-09 21:03   ` David Dillow
  0 siblings, 0 replies; 40+ messages in thread
From: David Dillow @ 2012-04-09 21:03 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, trivial, netdev

On Mon, 2012-04-09 at 22:50 +0200, Jesper Juhl wrote:
> There's no need to test for a NULL pointer before calling
> release_firmware() since the function does that check itself, so
> remove the redundant test.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

FWIW on a trivial patch,

Acked-by: David Dillow <dave@thedillows.org>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* RE: [PATCH 06/26] bna: remove redundant NULL test before release_firmware()
  2012-04-09 20:50 ` [PATCH 06/26] bna: remove redundant NULL test before release_firmware() Jesper Juhl
@ 2012-04-09 21:14   ` Rasesh Mody
  0 siblings, 0 replies; 40+ messages in thread
From: Rasesh Mody @ 2012-04-09 21:14 UTC (permalink / raw)
  To: Jesper Juhl, linux-kernel; +Cc: trivial, netdev

>From: Jesper Juhl [mailto:jj@chaosbits.net]
>Sent: Monday, April 09, 2012 1:50 PM
>To: linux-kernel@vger.kernel.org
>
>release_firmware() does its own NULL test so explicit test before call
>is unneeded.
>
>Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Thanks Jesper!

Acked-by: Rasesh Mody <rmody@brocade.com>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 23/26] ALSA: riptide: remove redundant NULL test before release_firmware()
  2012-04-09 20:52   ` Jesper Juhl
@ 2012-04-10  6:45     ` Takashi Iwai
  -1 siblings, 0 replies; 40+ messages in thread
From: Takashi Iwai @ 2012-04-10  6:45 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-kernel, trivial, alsa-devel, Clemens Ladisch,
	Rusty Russell, Paul Gortmaker, Jaroslav Kysela

At Mon, 9 Apr 2012 22:52:10 +0200 (CEST),
Jesper Juhl wrote:
> 
> release_firmware() deals gracefully with NULL pointers, no need to check first.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Applied now.  Thanks.


Takashi

> ---
>  sound/pci/riptide/riptide.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
> index 0481d94..cbeb3f7 100644
> --- a/sound/pci/riptide/riptide.c
> +++ b/sound/pci/riptide/riptide.c
> @@ -1837,8 +1837,7 @@ static int snd_riptide_free(struct snd_riptide *chip)
>  	}
>  	if (chip->irq >= 0)
>  		free_irq(chip->irq, chip);
> -	if (chip->fw_entry)
> -		release_firmware(chip->fw_entry);
> +	release_firmware(chip->fw_entry);
>  	release_and_free_resource(chip->res_port);
>  	kfree(chip);
>  	return 0;
> -- 
> 1.7.10
> 
> 
> -- 
> Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
> Don't top-post http://www.catb.org/jargon/html/T/top-post.html
> Plain text mails only, please.
> 

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 23/26] ALSA: riptide: remove redundant NULL test before release_firmware()
@ 2012-04-10  6:45     ` Takashi Iwai
  0 siblings, 0 replies; 40+ messages in thread
From: Takashi Iwai @ 2012-04-10  6:45 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: alsa-devel, trivial, Rusty Russell, Clemens Ladisch,
	linux-kernel, Paul Gortmaker

At Mon, 9 Apr 2012 22:52:10 +0200 (CEST),
Jesper Juhl wrote:
> 
> release_firmware() deals gracefully with NULL pointers, no need to check first.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Applied now.  Thanks.


Takashi

> ---
>  sound/pci/riptide/riptide.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
> index 0481d94..cbeb3f7 100644
> --- a/sound/pci/riptide/riptide.c
> +++ b/sound/pci/riptide/riptide.c
> @@ -1837,8 +1837,7 @@ static int snd_riptide_free(struct snd_riptide *chip)
>  	}
>  	if (chip->irq >= 0)
>  		free_irq(chip->irq, chip);
> -	if (chip->fw_entry)
> -		release_firmware(chip->fw_entry);
> +	release_firmware(chip->fw_entry);
>  	release_and_free_resource(chip->res_port);
>  	kfree(chip);
>  	return 0;
> -- 
> 1.7.10
> 
> 
> -- 
> Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
> Don't top-post http://www.catb.org/jargon/html/T/top-post.html
> Plain text mails only, please.
> 

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 24/26] ASoC: wm8994: Don't test for NULL before release_firmware()
  2012-04-09 20:52   ` Jesper Juhl
@ 2012-04-10 10:08     ` Mark Brown
  -1 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-04-10 10:08 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-kernel, trivial, alsa-devel, Takashi Iwai, Jaroslav Kysela,
	Liam Girdwood, Dimitris Papastamos, Ian Lartey

[-- Attachment #1: Type: text/plain, Size: 180 bytes --]

On Mon, Apr 09, 2012 at 10:52:19PM +0200, Jesper Juhl wrote:
> release_firmware() does its own NULL ptr testing, it's redundant to
> also test before calling it.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 24/26] ASoC: wm8994: Don't test for NULL before release_firmware()
@ 2012-04-10 10:08     ` Mark Brown
  0 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-04-10 10:08 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: Dimitris Papastamos, alsa-devel, trivial, Takashi Iwai,
	linux-kernel, Ian Lartey, Liam Girdwood


[-- Attachment #1.1: Type: text/plain, Size: 180 bytes --]

On Mon, Apr 09, 2012 at 10:52:19PM +0200, Jesper Juhl wrote:
> release_firmware() does its own NULL ptr testing, it's redundant to
> also test before calling it.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 19/26] [SCSI] qla2xxx: Remove redundant NULL check before release_firmware() call.
  2012-04-09 20:51 ` [PATCH 19/26] [SCSI] qla2xxx: " Jesper Juhl
@ 2012-04-10 12:22   ` Chad Dupuis
  0 siblings, 0 replies; 40+ messages in thread
From: Chad Dupuis @ 2012-04-10 12:22 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-kernel, trivial, linux-scsi, James E.J. Bottomley,
	Dept-Eng Linux Driver, Andrew Vasquez



On Mon, 9 Apr 2012, Jesper Juhl wrote:

> release_firmware() checks for NULL pointers internally so checking
> before calling it is redundant.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
> drivers/scsi/qla2xxx/qla_os.c |    3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index a2f9992..91b6fe6 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -4106,8 +4106,7 @@ qla2x00_release_firmware(void)
>
>       mutex_lock(&qla_fw_lock);
>       for (idx = 0; idx < FW_BLOBS; idx++)
> -             if (qla_fw_blobs[idx].fw)
> -                     release_firmware(qla_fw_blobs[idx].fw);
> +             release_firmware(qla_fw_blobs[idx].fw);
>       mutex_unlock(&qla_fw_lock);
> }
>
>

Acked-by: Chad Dupuis <chad.dupuis@qlogic.com>

This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.


^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 09/26] tehuti: delete redundant NULL check before release_firmware()
  2012-04-09 20:50 ` [PATCH 09/26] tehuti: delete redundant NULL check before release_firmware() Jesper Juhl
@ 2012-04-11 13:31   ` Andy Gospodarek
  0 siblings, 0 replies; 40+ messages in thread
From: Andy Gospodarek @ 2012-04-11 13:31 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, trivial, netdev, Andy Gospodarek

On Mon, Apr 09, 2012 at 10:50:42PM +0200, Jesper Juhl wrote:
> release_firmware() checks for NULL pointers - no need to test before
> the call.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>

> ---
>  drivers/net/ethernet/tehuti/tehuti.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c
> index ad973ff..a445e77 100644
> --- a/drivers/net/ethernet/tehuti/tehuti.c
> +++ b/drivers/net/ethernet/tehuti/tehuti.c
> @@ -341,8 +341,8 @@ static int bdx_fw_load(struct bdx_priv *priv)
>  out:
>  	if (master)
>  		WRITE_REG(priv, regINIT_SEMAPHORE, 1);
> -	if (fw)
> -		release_firmware(fw);
> +
> +	release_firmware(fw);
>  
>  	if (rc) {
>  		netdev_err(priv->ndev, "firmware loading failed\n");
> -- 
> 1.7.10
> 
> 
> -- 
> Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
> Don't top-post http://www.catb.org/jargon/html/T/top-post.html
> Plain text mails only, please.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 01/26] Bluetooth: btmrvl_sdio: remove pointless conditional before release_firmware()
  2012-04-09 20:49 ` [PATCH 01/26] Bluetooth: btmrvl_sdio: remove pointless conditional before release_firmware() Jesper Juhl
@ 2012-04-13 21:36   ` Gustavo Padovan
  0 siblings, 0 replies; 40+ messages in thread
From: Gustavo Padovan @ 2012-04-13 21:36 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-kernel, trivial, linux-bluetooth, Johan Hedberg, Marcel Holtmann

Hi Jesper,

* Jesper Juhl <jj@chaosbits.net> [2012-04-09 22:49:49 +0200]:

> release_firmware() deals gracefullt with NULL pointers so there's no
> reason to test for one prior to calling the function.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>  drivers/bluetooth/btmrvl_sdio.c |    9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)

Patch has been applied, thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2012-04-13 21:36 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-09 20:49 [PATCH 00/26] Remove redundant tests for NULL before calling release_firmware() Jesper Juhl
2012-04-09 20:49 ` [PATCH 01/26] Bluetooth: btmrvl_sdio: remove pointless conditional before release_firmware() Jesper Juhl
2012-04-13 21:36   ` Gustavo Padovan
2012-04-09 20:49 ` [PATCH 02/26] radeon_cp: Remove unneeded tests for NULL before calling release_firmware() Jesper Juhl
2012-04-09 20:50 ` [PATCH 03/26] [media] s2255drv: Remove redundant NULL test before release_firmware() Jesper Juhl
2012-04-09 20:50 ` [PATCH 04/26] typhoon: get rid of redundant conditional before all to release_firmware() Jesper Juhl
2012-04-09 21:03   ` David Dillow
2012-04-09 20:50 ` [PATCH 05/26] tg3: remove redundant NULL test before release_firmware() call Jesper Juhl
2012-04-09 20:50 ` [PATCH 06/26] bna: remove redundant NULL test before release_firmware() Jesper Juhl
2012-04-09 21:14   ` Rasesh Mody
2012-04-09 20:50 ` [PATCH 07/26] qlogic, netxen: get rid of a redundant test for NULL before call to release_firmware() Jesper Juhl
2012-04-09 20:50 ` [PATCH 08/26] qlogic, qlcnic: get rid of redundant test for NULL before a " Jesper Juhl
2012-04-09 20:50 ` [PATCH 09/26] tehuti: delete redundant NULL check before release_firmware() Jesper Juhl
2012-04-11 13:31   ` Andy Gospodarek
2012-04-09 20:50 ` [PATCH 10/26] wireless, at76c50x:: Don't needlessly test for NULL before calling release_firmware() Jesper Juhl
2012-04-09 20:50 ` [PATCH 11/26] wireless, atmel: remove pointless test for NULL before release_firmware() call Jesper Juhl
2012-04-09 20:50   ` Jesper Juhl
2012-04-09 20:51 ` [PATCH 12/26] ipw2200: remove a redundant NULL check before calling release_firmware() Jesper Juhl
2012-04-09 20:51 ` [PATCH 13/26] wireless, libertas: remove redundant NULL tests " Jesper Juhl
2012-04-09 20:51 ` [PATCH 14/26] wireless, mwifiex: drop redundant NULL test before call to release_firmware() Jesper Juhl
2012-04-09 20:59   ` Bing Zhao
2012-04-09 20:51 ` [PATCH 15/26] wireless, orinoco: release_firmware() tests for NULL, remove explicit tests before calls Jesper Juhl
2012-04-09 20:51 ` [PATCH 16/26] remoteproc: remove redundant NULL check before release_firmware() Jesper Juhl
2012-04-09 20:51 ` [PATCH 17/26] [SCSI] aic94xx: Get rid of redundant NULL check before release_firmware() call Jesper Juhl
2012-04-09 20:51 ` [PATCH 18/26] [SCSI] qla1280: Remove " Jesper Juhl
2012-04-09 20:51 ` [PATCH 19/26] [SCSI] qla2xxx: " Jesper Juhl
2012-04-10 12:22   ` Chad Dupuis
2012-04-09 20:51 ` [PATCH 20/26] [media] staging: as102: Remove redundant NULL check before release_firmware() and pointless comments Jesper Juhl
2012-04-09 20:51 ` [PATCH 21/26] staging: vt6656: Don't needlessly test for NULL before release_firmware() Jesper Juhl
2012-04-09 20:52 ` [PATCH 22/26] usb/storage/ene_ub6250: Remove redundant NULL check before release_firmware() and pointless assignment Jesper Juhl
2012-04-09 20:52 ` [PATCH 23/26] ALSA: riptide: remove redundant NULL test before release_firmware() Jesper Juhl
2012-04-09 20:52   ` Jesper Juhl
2012-04-10  6:45   ` Takashi Iwai
2012-04-10  6:45     ` Takashi Iwai
2012-04-09 20:52 ` [PATCH 24/26] ASoC: wm8994: Don't test for NULL " Jesper Juhl
2012-04-09 20:52   ` Jesper Juhl
2012-04-10 10:08   ` Mark Brown
2012-04-10 10:08     ` Mark Brown
2012-04-09 20:52 ` [PATCH 25/26] usb/atm/ueagle-atm: Don't test for NULL ptr before calling release_firmware() Jesper Juhl
2012-04-09 20:52 ` [PATCH 26/26] ipw2100: remove a redundant NULL check " Jesper Juhl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.