summaryrefslogtreecommitdiff
path: root/drivers/adc
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2019-06-21 15:26:44 +0200
committerPatrick Delaunay <patrick.delaunay@st.com>2019-07-12 11:50:55 +0200
commit0fb03656730a58fc79831c8bcc852bc9f628b960 (patch)
tree9f5adf5bbf4cf019147f18acfba282a8539d5bdb /drivers/adc
parent745b676d00c3cb3d6541fc3ef3290e3e880ae7ca (diff)
downloadu-boot-0fb03656730a58fc79831c8bcc852bc9f628b960.tar.gz
adc: stm32-adc: Fix warnings when compiling with W=1
This patch solves the following warnings: drivers/adc/stm32-adc.c: In function 'stm32_adc_chan_of_init': warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (num_channels > adc->cfg->max_channels) { ^ Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Diffstat (limited to 'drivers/adc')
-rw-r--r--drivers/adc/stm32-adc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/adc/stm32-adc.c b/drivers/adc/stm32-adc.c
index e108062f2f..029338e4af 100644
--- a/drivers/adc/stm32-adc.c
+++ b/drivers/adc/stm32-adc.c
@@ -163,15 +163,16 @@ static int stm32_adc_chan_of_init(struct udevice *dev)
struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
struct stm32_adc *adc = dev_get_priv(dev);
u32 chans[STM32_ADC_CH_MAX];
- int i, num_channels, ret;
+ unsigned int i, num_channels;
+ int ret;
/* Retrieve single ended channels listed in device tree */
- num_channels = dev_read_size(dev, "st,adc-channels");
- if (num_channels < 0) {
- dev_err(dev, "can't get st,adc-channels: %d\n", num_channels);
- return num_channels;
+ ret = dev_read_size(dev, "st,adc-channels");
+ if (ret < 0) {
+ dev_err(dev, "can't get st,adc-channels: %d\n", ret);
+ return ret;
}
- num_channels /= sizeof(u32);
+ num_channels = ret / sizeof(u32);
if (num_channels > adc->cfg->max_channels) {
dev_err(dev, "too many st,adc-channels: %d\n", num_channels);