egl: move bad_param check further up