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

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