Do not return the total number of available pins but the maximum pin number
we can cope.

Previously the returned value could prevent access to some of the pins.