The three if statements check the same thing, merge them in only one statement.
Showing the changes to drivers/media/rc/lirc_dev.c (1 of 1 file). Show all
Unified · Split
| @@ -270,15 +270,10 @@ static int lirc_allocate_driver(struct lirc_driver *d) · 269 unmodified lines | ||
| 270 | 270 | dev_err(d->dev, "add_to_buf not set\n"); |
| 271 | 271 | return -EBADRQC; |
| 272 | 272 | } |
| 273 | − } else if (!(d->fops && d->fops->read) && !d->rbuf) { | |
| 274 | − dev_err(d->dev, "fops->read and rbuf are NULL!\n"); | |
| 273 | + } else if (!d->rbuf && !(d->fops && d->fops->read && | |
| 274 | + d->fops->poll && d->fops->unlocked_ioctl)) { | |
| 275 | + dev_err(d->dev, "undefined read, poll, ioctl\n"); | |
| 275 | 276 | return -EBADRQC; |
| 276 | − } else if (!d->rbuf) { | |
| 277 | − if (!(d->fops && d->fops->read && d->fops->poll && | |
| 278 | − d->fops->unlocked_ioctl)) { | |
| 279 | − dev_err(d->dev, "undefined read, poll, ioctl\n"); | |
| 280 | − return -EBADRQC; | |
| 281 | − } | |
| 282 | 277 | } |
| 283 | 278 | |
| 284 | 279 | mutex_lock(&lirc_dev_lock); |