Skip to content

Commit

Permalink
[media] st-hva: fix some error handling in hva_hw_probe()
Browse files Browse the repository at this point in the history
The devm_ioremap_resource() returns error pointers, never NULL.  The
platform_get_resource() returns NULL on error, never error pointers.
The error code needs to be set, as well.  The current code returns
PTR_ERR(NULL) which is success.

Fixes: 57b2c06 ("[media] st-hva: multi-format video encoder V4L2 driver")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jean-Christophe Trotin <jean-christophe.trotin@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
  • Loading branch information
Dan Carpenter authored and Mauro Carvalho Chehab committed Nov 16, 2016
1 parent eadf081 commit 6b2bed8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/media/platform/sti/hva/hva-hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,16 @@ int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva)
/* get memory for registers */
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hva->regs = devm_ioremap_resource(dev, regs);
if (IS_ERR_OR_NULL(hva->regs)) {
if (IS_ERR(hva->regs)) {
dev_err(dev, "%s failed to get regs\n", HVA_PREFIX);
return PTR_ERR(hva->regs);
}

/* get memory for esram */
esram = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (IS_ERR_OR_NULL(esram)) {
if (!esram) {
dev_err(dev, "%s failed to get esram\n", HVA_PREFIX);
return PTR_ERR(esram);
return -ENODEV;
}
hva->esram_addr = esram->start;
hva->esram_size = resource_size(esram);
Expand Down

0 comments on commit 6b2bed8

Please sign in to comment.