Skip to content

Commit c7521d3

Browse files
Dan Carpenterdavem330
authored andcommitted
ptp: ocp: Fix a couple NULL vs IS_ERR() checks
The ptp_ocp_get_mem() function does not return NULL, it returns error pointers. Fixes: 773bda9 ("ptp: ocp: Expose various resources on the timecard.") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0fa68da commit c7521d3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/ptp/ptp_ocp.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,10 +1304,11 @@ ptp_ocp_register_ext(struct ptp_ocp *bp, struct ocp_resource *r)
13041304
if (!ext)
13051305
return -ENOMEM;
13061306

1307-
err = -EINVAL;
13081307
ext->mem = ptp_ocp_get_mem(bp, r);
1309-
if (!ext->mem)
1308+
if (IS_ERR(ext->mem)) {
1309+
err = PTR_ERR(ext->mem);
13101310
goto out;
1311+
}
13111312

13121313
ext->bp = bp;
13131314
ext->info = r->extra;
@@ -1371,8 +1372,8 @@ ptp_ocp_register_mem(struct ptp_ocp *bp, struct ocp_resource *r)
13711372
void __iomem *mem;
13721373

13731374
mem = ptp_ocp_get_mem(bp, r);
1374-
if (!mem)
1375-
return -EINVAL;
1375+
if (IS_ERR(mem))
1376+
return PTR_ERR(mem);
13761377

13771378
bp_assign_entry(bp, r, mem);
13781379

0 commit comments

Comments
 (0)