summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIoana Radulescu <ruxandra.radulescu@nxp.com>2017-09-20 15:04:28 (GMT)
committerXie Xiaobo <xiaobo.xie@nxp.com>2017-09-28 08:05:32 (GMT)
commit90db0bd337f61194513cf3c88b608415e7e6e6c2 (patch)
tree125bd6668ab39179298cfcd158139442d0d639f8
parent5d66d65e0ba36e2065bd91aaad076a75cbf5671e (diff)
downloadlinux-90db0bd337f61194513cf3c88b608415e7e6e6c2.tar.xz
staging: fsl-mc/dpio: Fix incorrect comparison
For some dpio functions, a negative cpu id parameter value is valid and means "any". But when trying to validate this param value against an upper limit, in this case num_possible_cpus(), we risk obtaining the wrong result due to an implicit cast. Avoid an incorrect check result when cpu id is negative, by explicitly stating the comparison is between signed values. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
-rw-r--r--drivers/staging/fsl-mc/bus/dpio/dpio-service.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
index 46c32a6..fe94eb4 100644
--- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
@@ -77,7 +77,7 @@ static inline struct dpaa2_io *service_select_by_cpu(struct dpaa2_io *d,
if (d)
return d;
- if (unlikely(cpu >= num_possible_cpus()))
+ if (unlikely(cpu >= (int)num_possible_cpus()))
return NULL;
/*
@@ -122,7 +122,7 @@ struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc)
return NULL;
/* check if CPU is out of range (-1 means any cpu) */
- if (desc->cpu >= num_possible_cpus()) {
+ if (desc->cpu >= (int)num_possible_cpus()) {
kfree(obj);
return NULL;
}