You should not remove this ibv_exp_query_device(), this should work (and working in identical setup in my lab) with no issues. There is another problem causing this.
1. Are you sure you have only one version of libibverbs in the system?
2. Can you please run some standard commands like ibstat, ibdev2netdev and ibv_devinfo (and paste it here) just to make sure?