Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 773bda964921 ("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>

authored by

Dan Carpenter and committed by
David S. Miller
c7521d3a 0fa68da7

+5 -4
+5 -4
drivers/ptp/ptp_ocp.c
··· 1304 1304 if (!ext) 1305 1305 return -ENOMEM; 1306 1306 1307 - err = -EINVAL; 1308 1307 ext->mem = ptp_ocp_get_mem(bp, r); 1309 - if (!ext->mem) 1308 + if (IS_ERR(ext->mem)) { 1309 + err = PTR_ERR(ext->mem); 1310 1310 goto out; 1311 + } 1311 1312 1312 1313 ext->bp = bp; 1313 1314 ext->info = r->extra; ··· 1372 1371 void __iomem *mem; 1373 1372 1374 1373 mem = ptp_ocp_get_mem(bp, r); 1375 - if (!mem) 1376 - return -EINVAL; 1374 + if (IS_ERR(mem)) 1375 + return PTR_ERR(mem); 1377 1376 1378 1377 bp_assign_entry(bp, r, mem); 1379 1378