Commit 3d37383b authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: davinci_vpfe: remove useless checks from ipipe

The dm365_ipipe_hw.c and dm365_ipipe.c file check if several table
pointers, declared at davinci_vpfe_user.h, are filled before using
them.

The problem is that those pointers come from struct declarations
like:

	struct vpfe_ipipe_yee {
	...
	short table[VPFE_IPIPE_MAX_SIZE_YEE_LUT];
	};

So, they can't be NULL! Solve those warnings:

    drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c:433 ipipe_set_lutdpc_regs() warn: this array is probably non-NULL. 'dpc->table'
    drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c:763 ipipe_set_gamma_regs() warn: this array is probably non-NULL. 'gamma->table_r'
    drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c:766 ipipe_set_gamma_regs() warn: this array is probably non-NULL. 'gamma->table_b'
    drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c:769 ipipe_set_gamma_regs() warn: this array is probably non-NULL. 'gamma->table_g'
    drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c:791 ipipe_set_3d_lut_regs() warn: this array is probably non-NULL. 'lut_3d->table'
    drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c:903 ipipe_set_gbce_regs() warn: this array is probably non-NULL. 'gbce->table'
    drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c:946 ipipe_set_ee_regs() warn: this array is probably non-NULL. 'ee->table'
    drivers/staging/media/davinci_vpfe/dm365_ipipe.c:59 ipipe_validate_lutdpc_params() warn: this array is probably non-NULL. 'lutdpc->table'
    drivers/staging/media/davinci_vpfe/dm365_ipipe.c:697 ipipe_get_gamma_params() warn: this array is probably non-NULL. 'gamma_param->table_r'
    drivers/staging/media/davinci_vpfe/dm365_ipipe.c:705 ipipe_get_gamma_params() warn: this array is probably non-NULL. 'gamma_param->table_g'
    drivers/staging/media/davinci_vpfe/dm365_ipipe.c:712 ipipe_get_gamma_params() warn: this array is probably non-NULL. 'gamma_param->table_b'
    drivers/staging/media/davinci_vpfe/dm365_ipipe.c:745 ipipe_get_3d_lut_params() warn: this array is probably non-NULL. 'lut_param->table'
    drivers/staging/media/davinci_vpfe/dm365_ipipe.c:926 ipipe_get_gbce_params() warn: this array is probably non-NULL. 'gbce_param->table'
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 4907c73d
...@@ -56,7 +56,7 @@ static int ipipe_validate_lutdpc_params(struct vpfe_ipipe_lutdpc *lutdpc) ...@@ -56,7 +56,7 @@ static int ipipe_validate_lutdpc_params(struct vpfe_ipipe_lutdpc *lutdpc)
lutdpc->dpc_size > LUT_DPC_MAX_SIZE) lutdpc->dpc_size > LUT_DPC_MAX_SIZE)
return -EINVAL; return -EINVAL;
if (lutdpc->en && !lutdpc->table) if (lutdpc->en)
return -EINVAL; return -EINVAL;
for (i = 0; i < lutdpc->dpc_size; i++) for (i = 0; i < lutdpc->dpc_size; i++)
...@@ -694,7 +694,7 @@ static int ipipe_get_gamma_params(struct vpfe_ipipe_device *ipipe, void *param) ...@@ -694,7 +694,7 @@ static int ipipe_get_gamma_params(struct vpfe_ipipe_device *ipipe, void *param)
table_size = gamma->tbl_size; table_size = gamma->tbl_size;
if (!gamma->bypass_r && !gamma_param->table_r) { if (!gamma->bypass_r) {
dev_err(dev, dev_err(dev,
"ipipe_get_gamma_params: table ptr empty for R\n"); "ipipe_get_gamma_params: table ptr empty for R\n");
return -EINVAL; return -EINVAL;
...@@ -702,14 +702,14 @@ static int ipipe_get_gamma_params(struct vpfe_ipipe_device *ipipe, void *param) ...@@ -702,14 +702,14 @@ static int ipipe_get_gamma_params(struct vpfe_ipipe_device *ipipe, void *param)
memcpy(gamma_param->table_r, gamma->table_r, memcpy(gamma_param->table_r, gamma->table_r,
(table_size * sizeof(struct vpfe_ipipe_gamma_entry))); (table_size * sizeof(struct vpfe_ipipe_gamma_entry)));
if (!gamma->bypass_g && !gamma_param->table_g) { if (!gamma->bypass_g) {
dev_err(dev, "ipipe_get_gamma_params: table ptr empty for G\n"); dev_err(dev, "ipipe_get_gamma_params: table ptr empty for G\n");
return -EINVAL; return -EINVAL;
} }
memcpy(gamma_param->table_g, gamma->table_g, memcpy(gamma_param->table_g, gamma->table_g,
(table_size * sizeof(struct vpfe_ipipe_gamma_entry))); (table_size * sizeof(struct vpfe_ipipe_gamma_entry)));
if (!gamma->bypass_b && !gamma_param->table_b) { if (!gamma->bypass_b) {
dev_err(dev, "ipipe_get_gamma_params: table ptr empty for B\n"); dev_err(dev, "ipipe_get_gamma_params: table ptr empty for B\n");
return -EINVAL; return -EINVAL;
} }
...@@ -739,13 +739,8 @@ static int ipipe_get_3d_lut_params(struct vpfe_ipipe_device *ipipe, void *param) ...@@ -739,13 +739,8 @@ static int ipipe_get_3d_lut_params(struct vpfe_ipipe_device *ipipe, void *param)
{ {
struct vpfe_ipipe_3d_lut *lut_param = param; struct vpfe_ipipe_3d_lut *lut_param = param;
struct vpfe_ipipe_3d_lut *lut = &ipipe->config.lut; struct vpfe_ipipe_3d_lut *lut = &ipipe->config.lut;
struct device *dev = ipipe->subdev.v4l2_dev->dev;
lut_param->en = lut->en; lut_param->en = lut->en;
if (!lut_param->table) {
dev_err(dev, "ipipe_get_3d_lut_params: Invalid table ptr\n");
return -EINVAL;
}
memcpy(lut_param->table, &lut->table, memcpy(lut_param->table, &lut->table,
(VPFE_IPIPE_MAX_SIZE_3D_LUT * (VPFE_IPIPE_MAX_SIZE_3D_LUT *
...@@ -919,14 +914,9 @@ static int ipipe_get_gbce_params(struct vpfe_ipipe_device *ipipe, void *param) ...@@ -919,14 +914,9 @@ static int ipipe_get_gbce_params(struct vpfe_ipipe_device *ipipe, void *param)
{ {
struct vpfe_ipipe_gbce *gbce_param = param; struct vpfe_ipipe_gbce *gbce_param = param;
struct vpfe_ipipe_gbce *gbce = &ipipe->config.gbce; struct vpfe_ipipe_gbce *gbce = &ipipe->config.gbce;
struct device *dev = ipipe->subdev.v4l2_dev->dev;
gbce_param->en = gbce->en; gbce_param->en = gbce->en;
gbce_param->type = gbce->type; gbce_param->type = gbce->type;
if (!gbce_param->table) {
dev_err(dev, "ipipe_get_gbce_params: Invalid table ptr\n");
return -EINVAL;
}
memcpy(gbce_param->table, gbce->table, memcpy(gbce_param->table, gbce->table,
(VPFE_IPIPE_MAX_SIZE_GBCE_LUT * sizeof(unsigned short))); (VPFE_IPIPE_MAX_SIZE_GBCE_LUT * sizeof(unsigned short)));
......
...@@ -430,9 +430,6 @@ ipipe_set_lutdpc_regs(void __iomem *base_addr, void __iomem *isp5_base_addr, ...@@ -430,9 +430,6 @@ ipipe_set_lutdpc_regs(void __iomem *base_addr, void __iomem *isp5_base_addr,
regw_ip(base_addr, LUT_DPC_START_ADDR, DPC_LUT_ADR); regw_ip(base_addr, LUT_DPC_START_ADDR, DPC_LUT_ADR);
regw_ip(base_addr, dpc->dpc_size, DPC_LUT_SIZ & LUT_DPC_SIZE_MASK); regw_ip(base_addr, dpc->dpc_size, DPC_LUT_SIZ & LUT_DPC_SIZE_MASK);
if (dpc->table == NULL)
return;
for (count = 0; count < dpc->dpc_size; count++) { for (count = 0; count < dpc->dpc_size; count++) {
if (count >= max_tbl_size) if (count >= max_tbl_size)
lut_start_addr = DPC_TB1_START_ADDR; lut_start_addr = DPC_TB1_START_ADDR;
...@@ -760,13 +757,13 @@ ipipe_set_gamma_regs(void __iomem *base_addr, void __iomem *isp5_base_addr, ...@@ -760,13 +757,13 @@ ipipe_set_gamma_regs(void __iomem *base_addr, void __iomem *isp5_base_addr,
table_size = gamma->tbl_size; table_size = gamma->tbl_size;
if (!gamma->bypass_r && gamma->table_r != NULL) if (!gamma->bypass_r)
ipipe_update_gamma_tbl(isp5_base_addr, gamma->table_r, ipipe_update_gamma_tbl(isp5_base_addr, gamma->table_r,
table_size, GAMMA_R_START_ADDR); table_size, GAMMA_R_START_ADDR);
if (!gamma->bypass_b && gamma->table_b != NULL) if (!gamma->bypass_b)
ipipe_update_gamma_tbl(isp5_base_addr, gamma->table_b, ipipe_update_gamma_tbl(isp5_base_addr, gamma->table_b,
table_size, GAMMA_B_START_ADDR); table_size, GAMMA_B_START_ADDR);
if (!gamma->bypass_g && gamma->table_g != NULL) if (!gamma->bypass_g)
ipipe_update_gamma_tbl(isp5_base_addr, gamma->table_g, ipipe_update_gamma_tbl(isp5_base_addr, gamma->table_g,
table_size, GAMMA_G_START_ADDR); table_size, GAMMA_G_START_ADDR);
} }
...@@ -787,10 +784,6 @@ ipipe_set_3d_lut_regs(void __iomem *base_addr, void __iomem *isp5_base_addr, ...@@ -787,10 +784,6 @@ ipipe_set_3d_lut_regs(void __iomem *base_addr, void __iomem *isp5_base_addr,
if (!lut_3d->en) if (!lut_3d->en)
return; return;
/* lut_3d enabled */
if (!lut_3d->table)
return;
/* valied table */ /* valied table */
tbl = lut_3d->table; tbl = lut_3d->table;
for (i = 0; i < VPFE_IPIPE_MAX_SIZE_3D_LUT; i++) { for (i = 0; i < VPFE_IPIPE_MAX_SIZE_3D_LUT; i++) {
...@@ -900,9 +893,6 @@ ipipe_set_gbce_regs(void __iomem *base_addr, void __iomem *isp5_base_addr, ...@@ -900,9 +893,6 @@ ipipe_set_gbce_regs(void __iomem *base_addr, void __iomem *isp5_base_addr,
regw_ip(base_addr, gbce->type, GBCE_TYP); regw_ip(base_addr, gbce->type, GBCE_TYP);
if (!gbce->table)
return;
for (count = 0; count < VPFE_IPIPE_MAX_SIZE_GBCE_LUT; count += 2) for (count = 0; count < VPFE_IPIPE_MAX_SIZE_GBCE_LUT; count += 2)
w_ip_table(isp5_base_addr, ((gbce->table[count + 1] & mask) << w_ip_table(isp5_base_addr, ((gbce->table[count + 1] & mask) <<
GBCE_ENTRY_SHIFT) | (gbce->table[count] & mask), GBCE_ENTRY_SHIFT) | (gbce->table[count] & mask),
...@@ -943,9 +933,6 @@ ipipe_set_ee_regs(void __iomem *base_addr, void __iomem *isp5_base_addr, ...@@ -943,9 +933,6 @@ ipipe_set_ee_regs(void __iomem *base_addr, void __iomem *isp5_base_addr,
regw_ip(base_addr, ee->es_gain_grad & YEE_THR_MASK, YEE_G_GAN); regw_ip(base_addr, ee->es_gain_grad & YEE_THR_MASK, YEE_G_GAN);
regw_ip(base_addr, ee->es_ofst_grad & YEE_THR_MASK, YEE_G_OFT); regw_ip(base_addr, ee->es_ofst_grad & YEE_THR_MASK, YEE_G_OFT);
if (ee->table == NULL)
return;
for (count = 0; count < VPFE_IPIPE_MAX_SIZE_YEE_LUT; count += 2) for (count = 0; count < VPFE_IPIPE_MAX_SIZE_YEE_LUT; count += 2)
w_ip_table(isp5_base_addr, ((ee->table[count + 1] & w_ip_table(isp5_base_addr, ((ee->table[count + 1] &
YEE_ENTRY_MASK) << YEE_ENTRY_SHIFT) | YEE_ENTRY_MASK) << YEE_ENTRY_SHIFT) |
......
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