gpu.c: create_kernel_vars: improve error handling