Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73ca66b9 authored by Magnus Damm's avatar Magnus Damm Committed by Linus Torvalds
Browse files

[PATCH] release_firmware() fixes



Use release_firmware() to free requested resources.

According to Documentation/firmware_class/README the request_firmware()
call should be followed by a release_firmware().  Some drivers do not
however free the firmware previously allocated with request_firmware().
This patch tries to fix this by making sure that release_firmware() is used
as expected.

Signed-off-by: default avatarMagnus Damm <magnus@valinux.co.jp>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 454d6fbc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -234,6 +234,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
	data->fw_data = kmalloc(firmware->size, GFP_KERNEL);
	if (!data->fw_data) {
		BT_ERR("Can't allocate memory for firmware image");
		release_firmware(firmware);
		usb_free_urb(data->urb);
		kfree(data->buffer);
		kfree(data);
+2 −2
Original line number Diff line number Diff line
@@ -896,9 +896,9 @@ static int nxt2002_init(struct dvb_frontend* fe)
	}

	ret = nxt2002_load_firmware(fe, fw);
	release_firmware(fw);
	if (ret) {
		printk("nxt2002: Writing firmware to device failed\n");
		release_firmware(fw);
		return ret;
	}
	printk("nxt2002: Firmware upload complete\n");
@@ -960,9 +960,9 @@ static int nxt2004_init(struct dvb_frontend* fe)
	}

	ret = nxt2004_load_firmware(fe, fw);
	release_firmware(fw);
	if (ret) {
		printk("nxt2004: Writing firmware to device failed\n");
		release_firmware(fw);
		return ret;
	}
	printk("nxt2004: Firmware upload complete\n");
+1 −1
Original line number Diff line number Diff line
@@ -437,10 +437,10 @@ static int or51211_init(struct dvb_frontend* fe)
		}

		ret = or51211_load_firmware(fe, fw);
		release_firmware(fw);
		if (ret) {
			printk(KERN_WARNING "or51211: Writing firmware to "
			       "device failed!\n");
			release_firmware(fw);
			return ret;
		}
		printk(KERN_INFO "or51211: Firmware upload complete.\n");
+1 −1
Original line number Diff line number Diff line
@@ -318,7 +318,6 @@ static int sp8870_init (struct dvb_frontend* fe)
	printk("sp8870: waiting for firmware upload (%s)...\n", SP8870_DEFAULT_FIRMWARE);
	if (state->config->request_firmware(fe, &fw, SP8870_DEFAULT_FIRMWARE)) {
		printk("sp8870: no firmware upload (timeout or file not found?)\n");
		release_firmware(fw);
		return -EIO;
	}

@@ -327,6 +326,7 @@ static int sp8870_init (struct dvb_frontend* fe)
		release_firmware(fw);
		return -EIO;
	}
	release_firmware(fw);
	printk("sp8870: firmware upload complete\n");

	/* enable TS output and interface pins */
+1 −1
Original line number Diff line number Diff line
@@ -520,9 +520,9 @@ static int sp887x_init(struct dvb_frontend* fe)
		}

		ret = sp887x_initial_setup(fe, fw);
		release_firmware(fw);
		if (ret) {
			printk("sp887x: writing firmware to device failed\n");
			release_firmware(fw);
			return ret;
		}
		printk("sp887x: firmware upload complete\n");
Loading