Lgtm fixes
This fixes some of warnings reported here https://lgtm.com/projects/g/mirror/xserver/alerts/?mode=tree
This is the same series that was sent on ML. It was lying there since March, I just remembered about it, and figured that development probably moved to gitlab nowadays, so here it is..
Edited by Konstantin Kharlamov