Commit eddd3263 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[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: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent c79a23f3
...@@ -322,13 +322,13 @@ static int blackbird_mbox_func(void *priv, u32 command, int in, int out, u32 dat ...@@ -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); memory_read(dev->core, dev->mailbox - 4, &value);
if (value != 0x12345678) { if (value != 0x12345678) {
dprintk(0, "Firmware and/or mailbox pointer not initialized or corrupted\n"); dprintk(0, "Firmware and/or mailbox pointer not initialized or corrupted\n");
return -1; return -EIO;
} }
memory_read(dev->core, dev->mailbox, &flag); memory_read(dev->core, dev->mailbox, &flag);
if (flag) { if (flag) {
dprintk(0, "ERROR: Mailbox appears to be in use (%x)\n", 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 */ 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 ...@@ -354,8 +354,8 @@ static int blackbird_mbox_func(void *priv, u32 command, int in, int out, u32 dat
if (0 != (flag & 4)) if (0 != (flag & 4))
break; break;
if (time_after(jiffies,timeout)) { if (time_after(jiffies,timeout)) {
dprintk(0, "ERROR: API Mailbox timeout\n"); dprintk(0, "ERROR: API Mailbox timeout %x\n", command);
return -1; return -EIO;
} }
udelay(10); udelay(10);
} }
...@@ -416,7 +416,7 @@ static int blackbird_find_mailbox(struct cx8802_dev *dev) ...@@ -416,7 +416,7 @@ static int blackbird_find_mailbox(struct cx8802_dev *dev)
} }
} }
dprintk(0, "Mailbox signature values not found!\n"); dprintk(0, "Mailbox signature values not found!\n");
return -1; return -EIO;
} }
static int blackbird_load_firmware(struct cx8802_dev *dev) static int blackbird_load_firmware(struct cx8802_dev *dev)
...@@ -445,24 +445,23 @@ 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) { if (retval != 0) {
dprintk(0, "ERROR: Hotplug firmware request failed (%s).\n", pr_err("Hotplug firmware request failed (%s).\n",
CX2341X_FIRM_ENC_FILENAME); CX2341X_FIRM_ENC_FILENAME);
dprintk(0, "Please fix your hotplug setup, the board will " pr_err("Please fix your hotplug setup, the board will not work without firmware loaded!\n");
"not work without firmware loaded!\n"); return -EIO;
return -1;
} }
if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) { 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); firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE);
release_firmware(firmware); release_firmware(firmware);
return -1; return -EINVAL;
} }
if (0 != memcmp(firmware->data, magic, 8)) { 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); release_firmware(firmware);
return -1; return -EINVAL;
} }
/* transfer to the chip */ /* transfer to the chip */
...@@ -480,12 +479,11 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) ...@@ -480,12 +479,11 @@ static int blackbird_load_firmware(struct cx8802_dev *dev)
memory_read(dev->core, i, &value); memory_read(dev->core, i, &value);
checksum -= ~value; checksum -= ~value;
} }
if (checksum) {
dprintk(0, "ERROR: Firmware load failed (checksum mismatch).\n");
release_firmware(firmware); release_firmware(firmware);
return -1; if (checksum) {
pr_err("Firmware load might have failed (checksum mismatch).\n");
return -EIO;
} }
release_firmware(firmware);
dprintk(0, "Firmware upload successful.\n"); dprintk(0, "Firmware upload successful.\n");
retval |= register_write(dev->core, IVTV_REG_HW_BLOCKS, IVTV_CMD_HW_BLOCKS_RST); retval |= register_write(dev->core, IVTV_REG_HW_BLOCKS, IVTV_CMD_HW_BLOCKS_RST);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment