From 84f0e17f78471857104a20dfc57711409f68d7bf Mon Sep 17 00:00:00 2001 From: Rogério Brito Date: Thu, 3 Feb 2011 01:42:05 -0200 Subject: Bluetooth: ath3k: Avoid duplication of code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In commit 86e09287e4f8c81831b4d4118a48597565f0d21b, to reduce memory usage, the functions of the ath3k module were rewritten to release the firmware blob after it has been loaded (successfully or not). The resuting code has some redundancy and the compiler can potentially produce better code if we omit a function call that is unconditionally executed in ,---- | if (ath3k_load_firmware(udev, firmware)) { | release_firmware(firmware); | return -EIO; | } | release_firmware(firmware); | | return 0; | } `---- It may also be argued that the rewritten code becomes easier to read, and also to see the code coverage of the snippet in question. Signed-off-by: Rogério Brito Cc: Alexander Holler Cc: "Gustavo F. Padovan" Cc: Miguel Ojeda Signed-off-by: Gustavo F. Padovan --- drivers/bluetooth/ath3k.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 333c21289d9..41dadacd3d1 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c @@ -108,6 +108,7 @@ static int ath3k_probe(struct usb_interface *intf, { const struct firmware *firmware; struct usb_device *udev = interface_to_usbdev(intf); + int ret; BT_DBG("intf %p id %p", intf, id); @@ -118,13 +119,10 @@ static int ath3k_probe(struct usb_interface *intf, return -EIO; } - if (ath3k_load_firmware(udev, firmware)) { - release_firmware(firmware); - return -EIO; - } + ret = ath3k_load_firmware(udev, firmware); release_firmware(firmware); - return 0; + return ret; } static void ath3k_disconnect(struct usb_interface *intf) -- cgit v1.2.3-70-g09d2