'dev' ptr used ("DEVICE_CTX(dev)") before it virified against NULL