This should really check that ````adc_dev->driver->number_of_channels and get_pin```` are not NULL before dereferencing them.