Skip to content

Commit

Permalink
counter: ti-ecap-capture: fix IS_ERR() vs NULL check
Browse files Browse the repository at this point in the history
The devm_counter_alloc() function returns NULL on error.  It doesn't
return error pointers.

Fixes: 4e2f42a ("counter: ti-ecap-capture: capture driver support for ECAP")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Julien Panis <jpanis@baylibre.com>
Acked-by: Vignesh Raghavendra <vigneshr@ti.com>
Link: https://lore.kernel.org/r/Y0bUbZvfDJHBG9C6@kili/
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
  • Loading branch information
Dan Carpenter authored and William Breathitt Gray committed Oct 17, 2022
1 parent 472a148 commit ec0286d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/counter/ti-ecap-capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,8 @@ static int ecap_cnt_probe(struct platform_device *pdev)
int ret;

counter_dev = devm_counter_alloc(dev, sizeof(*ecap_dev));
if (IS_ERR(counter_dev))
return PTR_ERR(counter_dev);
if (!counter_dev)
return -ENOMEM;

counter_dev->name = ECAP_DRV_NAME;
counter_dev->parent = dev;
Expand Down

0 comments on commit ec0286d

Please sign in to comment.