From: Hans Verkuil Date: Fri, 29 Aug 2014 08:29:19 +0000 (-0300) Subject: [media] cx88: return proper errors during fw load X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=eddd3263208e3e4f80665bbec9d16f02c98986e8;p=openwrt%2Fstaging%2Fblogic.git [media] cx88: return proper errors during fw load Don't return -1, return a proper error. Replace dprintk(0, ...) by pr_err since firmware load errors should just be reported as an error. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/pci/cx88/cx88-blackbird.c b/drivers/media/pci/cx88/cx88-blackbird.c index 32abba47a937..11054cd903af 100644 --- a/drivers/media/pci/cx88/cx88-blackbird.c +++ b/drivers/media/pci/cx88/cx88-blackbird.c @@ -322,13 +322,13 @@ static int blackbird_mbox_func(void *priv, u32 command, int in, int out, u32 dat memory_read(dev->core, dev->mailbox - 4, &value); if (value != 0x12345678) { dprintk(0, "Firmware and/or mailbox pointer not initialized or corrupted\n"); - return -1; + return -EIO; } memory_read(dev->core, dev->mailbox, &flag); if (flag) { dprintk(0, "ERROR: Mailbox appears to be in use (%x)\n", flag); - return -1; + return -EIO; } flag |= 1; /* tell 'em we're working on it */ @@ -354,8 +354,8 @@ static int blackbird_mbox_func(void *priv, u32 command, int in, int out, u32 dat if (0 != (flag & 4)) break; if (time_after(jiffies,timeout)) { - dprintk(0, "ERROR: API Mailbox timeout\n"); - return -1; + dprintk(0, "ERROR: API Mailbox timeout %x\n", command); + return -EIO; } udelay(10); } @@ -416,7 +416,7 @@ static int blackbird_find_mailbox(struct cx8802_dev *dev) } } dprintk(0, "Mailbox signature values not found!\n"); - return -1; + return -EIO; } static int blackbird_load_firmware(struct cx8802_dev *dev) @@ -445,24 +445,23 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) if (retval != 0) { - dprintk(0, "ERROR: Hotplug firmware request failed (%s).\n", + pr_err("Hotplug firmware request failed (%s).\n", CX2341X_FIRM_ENC_FILENAME); - dprintk(0, "Please fix your hotplug setup, the board will " - "not work without firmware loaded!\n"); - return -1; + pr_err("Please fix your hotplug setup, the board will not work without firmware loaded!\n"); + return -EIO; } if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) { - dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d)\n", + pr_err("Firmware size mismatch (have %zd, expected %d)\n", firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE); release_firmware(firmware); - return -1; + return -EINVAL; } if (0 != memcmp(firmware->data, magic, 8)) { - dprintk(0, "ERROR: Firmware magic mismatch, wrong file?\n"); + pr_err("Firmware magic mismatch, wrong file?\n"); release_firmware(firmware); - return -1; + return -EINVAL; } /* transfer to the chip */ @@ -480,12 +479,11 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) memory_read(dev->core, i, &value); checksum -= ~value; } + release_firmware(firmware); if (checksum) { - dprintk(0, "ERROR: Firmware load failed (checksum mismatch).\n"); - release_firmware(firmware); - return -1; + pr_err("Firmware load might have failed (checksum mismatch).\n"); + return -EIO; } - release_firmware(firmware); dprintk(0, "Firmware upload successful.\n"); retval |= register_write(dev->core, IVTV_REG_HW_BLOCKS, IVTV_CMD_HW_BLOCKS_RST);