aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAndi Shyti <andi.shyti@samsung.com>2016-07-06 06:01:23 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-13 15:25:41 -0300
commit9675ee5a8e42807ebd33bf4934f235911b5647b0 (patch)
tree62b80ec047161f173f3d15bd24ddcb6628688194 /drivers/media
parent[media] lirc_dev: merge three if statements in only one (diff)
downloadlinux-dev-9675ee5a8e42807ebd33bf4934f235911b5647b0.tar.xz
linux-dev-9675ee5a8e42807ebd33bf4934f235911b5647b0.zip
[media] lirc_dev: fix variable constant comparisons
When comparing a variable with a constant, the comparison should start from the variable and not from the constant. It's also written in the human DNA. Swap the terms of comparisons whenever the constant comes first and fix the following checkpatch warning: WARNING: Comparisons should place the constant on the right side of the test Signed-off-by: Andi Shyti <andi.shyti@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/rc/lirc_dev.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 71ff82028c80..2bdd2c0a9268 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -248,13 +248,13 @@ static int lirc_allocate_driver(struct lirc_driver *d)
return -EINVAL;
}
- if (MAX_IRCTL_DEVICES <= d->minor) {
+ if (d->minor >= MAX_IRCTL_DEVICES) {
dev_err(d->dev, "minor must be between 0 and %d!\n",
MAX_IRCTL_DEVICES - 1);
return -EBADRQC;
}
- if (1 > d->code_length || (BUFLEN * 8) < d->code_length) {
+ if (d->code_length < 1 || d->code_length > (BUFLEN * 8)) {
dev_err(d->dev, "code length must be less than %d bits\n",
BUFLEN * 8);
return -EBADRQC;
@@ -285,7 +285,7 @@ static int lirc_allocate_driver(struct lirc_driver *d)
for (minor = 0; minor < MAX_IRCTL_DEVICES; minor++)
if (!irctls[minor])
break;
- if (MAX_IRCTL_DEVICES == minor) {
+ if (minor == MAX_IRCTL_DEVICES) {
dev_err(d->dev, "no free slots for drivers!\n");
err = -ENOMEM;
goto out_lock;