Message ID | Y0bUbZvfDJHBG9C6@kili (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | counter: ti-ecap-capture: fix IS_ERR() vs NULL check | expand |
Reviewed-by: Julien Panis <jpanis@baylibre.com> On 12/10/2022 16:51, Dan Carpenter wrote: > 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> > --- > drivers/counter/ti-ecap-capture.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/counter/ti-ecap-capture.c b/drivers/counter/ti-ecap-capture.c > index af10de30aba5..8104d02bb5a4 100644 > --- a/drivers/counter/ti-ecap-capture.c > +++ b/drivers/counter/ti-ecap-capture.c > @@ -479,8 +479,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;
Hi, On 12/10/22 8:21 pm, Dan Carpenter wrote: > 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> Acked-by: Vignesh Raghavendra <vigneshr@ti.com> Thanks for the fix! > --- > drivers/counter/ti-ecap-capture.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/counter/ti-ecap-capture.c b/drivers/counter/ti-ecap-capture.c > index af10de30aba5..8104d02bb5a4 100644 > --- a/drivers/counter/ti-ecap-capture.c > +++ b/drivers/counter/ti-ecap-capture.c > @@ -479,8 +479,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;
On Wed, Oct 12, 2022 at 05:51:25PM +0300, Dan Carpenter wrote: > 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> Queued for counter-fixes. Thank you, William Breathitt Gray
diff --git a/drivers/counter/ti-ecap-capture.c b/drivers/counter/ti-ecap-capture.c index af10de30aba5..8104d02bb5a4 100644 --- a/drivers/counter/ti-ecap-capture.c +++ b/drivers/counter/ti-ecap-capture.c @@ -479,8 +479,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;
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> --- drivers/counter/ti-ecap-capture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)