summaryrefslogtreecommitdiff
path: root/drivers/counter
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2022-10-12 17:51:25 +0300
committerWilliam Breathitt Gray <william.gray@linaro.org>2022-10-17 09:51:29 -0400
commitec0286dce78c3bb0e6a665c0baade2f2db56ce00 (patch)
tree460ea51df32bac0780d3b019d244ca8c0e37541d /drivers/counter
parent472a1482325b3a285e0bcf82c0b0edc689b7e8cd (diff)
downloadlinux-ec0286dce78c3bb0e6a665c0baade2f2db56ce00.tar.gz
counter: ti-ecap-capture: fix IS_ERR() vs NULL check
The devm_counter_alloc() function returns NULL on error. It doesn't return error pointers. Fixes: 4e2f42aa00b6 ("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>
Diffstat (limited to 'drivers/counter')
-rw-r--r--drivers/counter/ti-ecap-capture.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/counter/ti-ecap-capture.c b/drivers/counter/ti-ecap-capture.c
index b8dbf0212a8e..fb1cb1774674 100644
--- a/drivers/counter/ti-ecap-capture.c
+++ b/drivers/counter/ti-ecap-capture.c
@@ -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;