There are two if ... else which check the same thing in different
part of the code, they can be merged in a single check.
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
        irctls[minor] = ir;
        d->minor = minor;
 
-       if (d->sample_rate) {
-               ir->jiffies_to_wait = HZ / d->sample_rate;
-       } else {
-               /* it means - wait for external event in task queue */
-               ir->jiffies_to_wait = 0;
-       }
-
        /* some safety check 8-) */
        d->name[sizeof(d->name)-1] = '\0';
 
                      "lirc%u", ir->d.minor);
 
        if (d->sample_rate) {
+               ir->jiffies_to_wait = HZ / d->sample_rate;
+
                /* try to fire up polling thread */
                ir->task = kthread_run(lirc_thread, (void *)ir, "lirc_dev");
                if (IS_ERR(ir->task)) {
                        err = -ECHILD;
                        goto out_sysfs;
                }
+       } else {
+               /* it means - wait for external event in task queue */
+               ir->jiffies_to_wait = 0;
        }
 
        err = lirc_cdev_add(ir);