S5J has 4 ADC channels maximum. If it is requested to be configured
greater than that, s5j_adc_initialize() should return an error.
Change-Id: I4dd071c288b530b90c86b55dca78a12b9cc1bde6
Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
uint8_t current; /* Current ADC channel being converted */
struct work_s work; /* Supports the IRQ handling */
- uint8_t chanlist[4];
+ uint8_t chanlist[S5J_ADC_MAX_CHANNELS];
};
/****************************************************************************
priv->dev = &g_adcdev;
priv->cchannels = cchannels;
+ if (cchannels > S5J_ADC_MAX_CHANNELS) {
+ lldbg("S5J has maximum %d ADC channels.\n",
+ S5J_ADC_MAX_CHANNELS);
+ return NULL;
+ }
+
memcpy(priv->chanlist, chanlist, cchannels);
return &g_adcdev;
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
+#define S5J_ADC_MAX_CHANNELS 4
#ifndef __ASSEMBLY__