diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-11-18 14:22:11 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-11-25 11:48:40 +0300 |
commit | 20540cb666a6f0d218d29bc0c6fb371cd64fad8c (patch) | |
tree | 01f3e9ff30ebf83f2a2d18e845f7e4058052bf96 /drivers/ptp | |
parent | 4d42da0c86b87de11da775b7994fbc1cea4d63b1 (diff) | |
download | linux-20540cb666a6f0d218d29bc0c6fb371cd64fad8c.tar.xz |
ptp: ocp: Fix a couple NULL vs IS_ERR() checks
[ Upstream commit c7521d3aa2fa7fc785682758c99b5bcae503f6be ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/ptp')
-rw-r--r-- | drivers/ptp/ptp_ocp.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index caf9b37c5eb1..e238ae8e9470 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -1049,10 +1049,11 @@ ptp_ocp_register_ext(struct ptp_ocp *bp, struct ocp_resource *r) if (!ext) return -ENOMEM; - err = -EINVAL; ext->mem = ptp_ocp_get_mem(bp, r); - if (!ext->mem) + if (IS_ERR(ext->mem)) { + err = PTR_ERR(ext->mem); goto out; + } ext->bp = bp; ext->info = r->extra; @@ -1122,8 +1123,8 @@ ptp_ocp_register_mem(struct ptp_ocp *bp, struct ocp_resource *r) void __iomem *mem; mem = ptp_ocp_get_mem(bp, r); - if (!mem) - return -EINVAL; + if (IS_ERR(mem)) + return PTR_ERR(mem); bp_assign_entry(bp, r, mem); |