diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-27 16:27:32 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-27 16:57:43 -0300 |
commit | 52841e5e145afdf5cc070863c383f41db8472575 (patch) | |
tree | 81f7791da8100f9fb2d517febfaa6fe8e79e067c /drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c | |
parent | 4d2a7d3509f52106c50007c1dc0b8d79e8040128 (diff) | |
download | linux-next-52841e5e145afdf5cc070863c383f41db8472575.tar.gz |
[media] cx231xx: return an error if it can't read PCB config
Instead of using some random value, return an error if the
PCB config is not available or doesn't match a know profile
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c')
-rw-r--r-- | drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c b/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c index 2a34ceee4802..3052c4c20229 100644 --- a/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c +++ b/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c @@ -654,8 +654,9 @@ static struct pcb_config cx231xx_Scenario[] = { /*****************************************************************/ -u32 initialize_cx231xx(struct cx231xx *dev) +int initialize_cx231xx(struct cx231xx *dev) { + int retval; u32 config_info = 0; struct pcb_config *p_pcb_info; u8 usb_speed = 1; /* from register,1--HS, 0--FS */ @@ -670,7 +671,10 @@ u32 initialize_cx231xx(struct cx231xx *dev) /* read board config register to find out which pcb config it is related to */ - cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, BOARD_CFG_STAT, data, 4); + retval = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, BOARD_CFG_STAT, + data, 4); + if (retval < 0) + return retval; config_info = le32_to_cpu(*((__le32 *)data)); usb_speed = (u8) (config_info & 0x1); @@ -767,7 +771,7 @@ u32 initialize_cx231xx(struct cx231xx *dev) cx231xx_info("bad senario!!!!!\n"); cx231xx_info("config_info=%x\n", (config_info & SELFPOWER_MASK)); - return 1; + return -ENODEV; } } |