i2c: core: fix NULL pointer dereference under race condition