Commit ccc5429f authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] cx231xx: return proper error codes at cx231xx-417.c

Instead of returning -1, return valid error codes.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 12548808
...@@ -360,7 +360,7 @@ static int wait_for_mci_complete(struct cx231xx *dev) ...@@ -360,7 +360,7 @@ static int wait_for_mci_complete(struct cx231xx *dev)
if (count++ > 100) { if (count++ > 100) {
dprintk(3, "ERROR: Timeout - gpio=%x\n", gpio); dprintk(3, "ERROR: Timeout - gpio=%x\n", gpio);
return -1; return -EIO;
} }
} }
return 0; return 0;
...@@ -856,7 +856,7 @@ static int cx231xx_find_mailbox(struct cx231xx *dev) ...@@ -856,7 +856,7 @@ static int cx231xx_find_mailbox(struct cx231xx *dev)
} }
} }
dprintk(3, "Mailbox signature values not found!\n"); dprintk(3, "Mailbox signature values not found!\n");
return -1; return -EIO;
} }
static void mci_write_memory_to_gpio(struct cx231xx *dev, u32 address, u32 value, static void mci_write_memory_to_gpio(struct cx231xx *dev, u32 address, u32 value,
...@@ -960,14 +960,14 @@ static int cx231xx_load_firmware(struct cx231xx *dev) ...@@ -960,14 +960,14 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
p_fw = p_current_fw; p_fw = p_current_fw;
if (p_current_fw == NULL) { if (p_current_fw == NULL) {
dprintk(2, "FAIL!!!\n"); dprintk(2, "FAIL!!!\n");
return -1; return -ENOMEM;
} }
p_buffer = vmalloc(4096); p_buffer = vmalloc(4096);
if (p_buffer == NULL) { if (p_buffer == NULL) {
dprintk(2, "FAIL!!!\n"); dprintk(2, "FAIL!!!\n");
vfree(p_current_fw); vfree(p_current_fw);
return -1; return -ENOMEM;
} }
dprintk(2, "%s()\n", __func__); dprintk(2, "%s()\n", __func__);
...@@ -992,7 +992,7 @@ static int cx231xx_load_firmware(struct cx231xx *dev) ...@@ -992,7 +992,7 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
"%s: Error with mc417_register_write\n", __func__); "%s: Error with mc417_register_write\n", __func__);
vfree(p_current_fw); vfree(p_current_fw);
vfree(p_buffer); vfree(p_buffer);
return -1; return retval;
} }
retval = request_firmware(&firmware, CX231xx_FIRM_IMAGE_NAME, retval = request_firmware(&firmware, CX231xx_FIRM_IMAGE_NAME,
...@@ -1006,7 +1006,7 @@ static int cx231xx_load_firmware(struct cx231xx *dev) ...@@ -1006,7 +1006,7 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
"Please fix your hotplug setup, the board will not work without firmware loaded!\n"); "Please fix your hotplug setup, the board will not work without firmware loaded!\n");
vfree(p_current_fw); vfree(p_current_fw);
vfree(p_buffer); vfree(p_buffer);
return -1; return retval;
} }
if (firmware->size != CX231xx_FIRM_IMAGE_SIZE) { if (firmware->size != CX231xx_FIRM_IMAGE_SIZE) {
...@@ -1016,7 +1016,7 @@ static int cx231xx_load_firmware(struct cx231xx *dev) ...@@ -1016,7 +1016,7 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
release_firmware(firmware); release_firmware(firmware);
vfree(p_current_fw); vfree(p_current_fw);
vfree(p_buffer); vfree(p_buffer);
return -1; return -EINVAL;
} }
if (0 != memcmp(firmware->data, magic, 8)) { if (0 != memcmp(firmware->data, magic, 8)) {
...@@ -1025,7 +1025,7 @@ static int cx231xx_load_firmware(struct cx231xx *dev) ...@@ -1025,7 +1025,7 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
release_firmware(firmware); release_firmware(firmware);
vfree(p_current_fw); vfree(p_current_fw);
vfree(p_buffer); vfree(p_buffer);
return -1; return -EINVAL;
} }
initGPIO(dev); initGPIO(dev);
...@@ -1140,21 +1140,21 @@ static int cx231xx_initialize_codec(struct cx231xx *dev) ...@@ -1140,21 +1140,21 @@ static int cx231xx_initialize_codec(struct cx231xx *dev)
if (retval < 0) { if (retval < 0) {
dev_err(dev->dev, "%s: mailbox < 0, error\n", dev_err(dev->dev, "%s: mailbox < 0, error\n",
__func__); __func__);
return -1; return retval;
} }
dev->cx23417_mailbox = retval; dev->cx23417_mailbox = retval;
retval = cx231xx_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); retval = cx231xx_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0);
if (retval < 0) { if (retval < 0) {
dev_err(dev->dev, dev_err(dev->dev,
"ERROR: cx23417 firmware ping failed!\n"); "ERROR: cx23417 firmware ping failed!\n");
return -1; return retval;
} }
retval = cx231xx_api_cmd(dev, CX2341X_ENC_GET_VERSION, 0, 1, retval = cx231xx_api_cmd(dev, CX2341X_ENC_GET_VERSION, 0, 1,
&version); &version);
if (retval < 0) { if (retval < 0) {
dev_err(dev->dev, dev_err(dev->dev,
"ERROR: cx23417 firmware get encoder: version failed!\n"); "ERROR: cx23417 firmware get encoder: version failed!\n");
return -1; return retval;
} }
dprintk(1, "cx23417 firmware version is 0x%08x\n", version); dprintk(1, "cx23417 firmware version is 0x%08x\n", version);
msleep(200); msleep(200);
......
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