Help on gpio load i2c

I tried to enable I2C device, and failed to read WHO_AM_I reg with wiringPi interface, which return -1 instead of device ID.
---------------------code piece------------------
if(-1 == wiringPiSetup () ) {
printf(“wiringPi setup error\n”);
return -1 ;
}

fd = wiringPiI2CSetup (SlaveAddress);
if(fd < 0) {
       printf("wiringPii2csetup slaveaddress1 error\n");
       return -1 ;
}
res = wiringPiI2CReadReg8(fd, WHO_AM_I);
printf("whoami:%d\n", res);

And I can use i2cdect to probe my device address, and i2cget(WHO_AM_I) also return right device ID.
can anyone help me here?
Thanks,
Tiger

I guess the failure above is because i2c module is loaded. then running “gpio load i2c” get following error:
gpio: Unable to load/unload modules as this Pi has the device tree enabled.
You need to run the raspi-config program (as root) and select the
modules (SPI or I2C) that you wish to load/unload there and reboot.