Ibn battuta was from Morocco. The man had gone on pilgrimage to Mecca. So after his pilgrimage be decided to travel some parts of the world out of curiosity.
During the end of his travels he decided to visit west africa. He visited mali and several places like walata, kangana. In the map that is attached to this story,one can see that he didn't take a direct route after he left kangaba. The reason was so he could see more places