[SYCL] Fix Coverity null reference hits, divide by 0 hits (#15247)
This PR fixes many Coverity hits:
- Adds checks ensuring potentially nullable values are not dereferenced
- Adds a sanity check on get_mem_granularity, ensuring memory
granularity can never be 0
- This is done to fix a divide by 0 coverity hit, as the return result
of get_mem_granularity is used directly in division.