NVRM: nvidia_frontend_ioctl: minor 0, module->ioctl failed, error -22

Hi all:
I am trying to get some informations about my M40 GPU, I use nvml library to get, but i got this error:

kernel: NVRM: nvidia_frontend_ioctl: minor 0, module->ioctl failed, error -22

After some debug, i find this error maybe has something with nvmlInit(),  becasue when i delete all other api callings except this one, it  will give this error; when i delete this init api, this error is not show too;
can someone tell me what is error means? How can i fix it?

Your driver or GDK is probably not installed correctly.

You should make sure your driver is installed correctly, and use nvml/GDK packages and libraries that are consistent with the driver you have installed.