From ded9757de77adb99448ab46d12602aad60d3a737 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 19 Jul 2006 12:49:39 -0300 Subject: [PATCH] release_firmware() fixes From: Magnus Damm 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. kernel-sync: backport from kernel to v4l/dvb tree Signed-off-by: Magnus Damm Acked-by: Marcel Holtmann Cc: Mauro Carvalho Chehab Cc: "John W. Linville" Cc: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/cx88/cx88-blackbird.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'linux/drivers/media/video/cx88') diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index cdc4e76fe..5888eb2dd 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -464,11 +464,13 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) { dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d)\n", firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE); + release_firmware(firmware); return -1; } if (0 != memcmp(firmware->data, magic, 8)) { dprintk(0, "ERROR: Firmware magic mismatch, wrong file?\n"); + release_firmware(firmware); return -1; } @@ -489,6 +491,7 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) } if (checksum) { dprintk(0, "ERROR: Firmware load failed (checksum mismatch).\n"); + release_firmware(firmware); return -1; } release_firmware(firmware); -- cgit v1.2.3