Skip to contentSkip to conversation

iio: adc: checking for NULL instead of IS_ERR() in probe

PATCH In review Dan Carpenter 3 participants 6 messages Mar 28, 2014 – Jun 15, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: adc: checking for NULL instead of IS_ERR() in probe

mcb_request_mem() returns an ERR_PTR(), it doesn't return NULL.

Fixes 74aeac4da66f ('iio: adc: Add MEN 16z188 ADC driver')
drivers/iio/adc/men_z188_adc.c +2 -2
index 6989c16..b58d630 100644
@@ -121,8 +121,8 @@ static int men_z188_probe(struct mcb_device *dev,
 	indio_dev->num_channels = ARRAY_SIZE(z188_adc_iio_channels);
 
 	mem = mcb_request_mem(dev, "z188-adc");
-	if (!mem)
-		return -ENOMEM;
+	if (IS_ERR(mem))
+		return PTR_ERR(mem);
 
 	adc->base = ioremap(mem->start, resource_size(mem));
 	if (adc->base = NULL)
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Dan Carpenter

mcb_request_mem() returns an ERR_PTR(), it doesn't return NULL.

Fixes 74aeac4da66f ('iio: adc: Add MEN 16z188 ADC driver')
drivers/iio/adc/men_z188_adc.c +0 -0
index 6989c16..b58d630 100644

drivers/iio/adc/men_z188_adc.c static int men_z188_probe(struct mcb_device *dev, · line 128

Quoted 10 lines
drivers/iio/adc/men_z188_adc.c +2 -2
@@ -121,8 +121,8 @@ static int men_z188_probe(struct mcb_device *dev,
        indio_dev->num_channels = ARRAY_SIZE(z188_adc_iio_channels);
 
        mem = mcb_request_mem(dev, "z188-adc");
-       if (!mem)
-               return -ENOMEM;
+       if (IS_ERR(mem))
+               return PTR_ERR(mem);
 
        adc->base = ioremap(mem->start, resource_size(mem));
        if (adc->base = NULL)
maintainer Acked-by
#2 lore raw
Quoted 20 lines · johannes thumshirn
Quoted 19 lines · Dan Carpenter

mcb_request_mem() returns an ERR_PTR(), it doesn't return NULL.

Fixes 74aeac4da66f ('iio: adc: Add MEN 16z188 ADC driver')
drivers/iio/adc/men_z188_adc.c +2 -2
index 6989c16..b58d630 100644
@@ -121,8 +121,8 @@ static int men_z188_probe(struct mcb_device *dev,
         indio_dev->num_channels = ARRAY_SIZE(z188_adc_iio_channels);
 
         mem = mcb_request_mem(dev, "z188-adc");
-       if (!mem)
-               return -ENOMEM;
+       if (IS_ERR(mem))
+               return PTR_ERR(mem);
 
Quoted 5 lines

drivers/iio/adc/men_z188_adc.c static int men_z188_probe(struct mcb_device *dev, · line 128

Quoted 2 lines
drivers/iio/adc/men_z188_adc.c +0 -0
         adc->base = ioremap(mem->start, resource_size(mem));
         if (adc->base == NULL)

Or I can pick this up after the merge window has closed if Greg hasn't already taken it.

Jonathan

#3 lore raw
Quoted 26 lines · Jonathan Cameron
Quoted 20 lines · johannes thumshirn
Quoted 19 lines · Dan Carpenter

mcb_request_mem() returns an ERR_PTR(), it doesn't return NULL.

Fixes 74aeac4da66f ('iio: adc: Add MEN 16z188 ADC driver')
drivers/iio/adc/men_z188_adc.c +2 -2
index 6989c16..b58d630 100644
@@ -121,8 +121,8 @@ static int men_z188_probe(struct mcb_device *dev,
         indio_dev->num_channels = ARRAY_SIZE(z188_adc_iio_channels);
 
         mem = mcb_request_mem(dev, "z188-adc");
-       if (!mem)
-               return -ENOMEM;
+       if (IS_ERR(mem))
+               return PTR_ERR(mem);
 
Quoted 5 lines

drivers/iio/adc/men_z188_adc.c static int men_z188_probe(struct mcb_device *dev, · line 128

Quoted 2 lines
drivers/iio/adc/men_z188_adc.c +0 -0
         adc->base = ioremap(mem->start, resource_size(mem));
         if (adc->base = NULL)
Quoted 6 lines

Or I can pick this up after the merge window has closed if Greg hasn't already taken it.

Jonathan

Did someone actually take this patch, or was it somehow lost?

Johannes

maintainer
#4 lore raw
Quoted 28 lines · Johannes Thumshirn
Quoted 26 lines · Jonathan Cameron
Quoted 25 lines · johannes thumshirn
Quoted 11 lines · Dan Carpenter

mcb_request_mem() returns an ERR_PTR(), it doesn't return NULL.

Fixes 74aeac4da66f ('iio: adc: Add MEN 16z188 ADC driver')
drivers/iio/adc/men_z188_adc.c +0 -0
index 6989c16..b58d630 100644

drivers/iio/adc/men_z188_adc.c static int men_z188_probe(struct mcb_device *dev, · line 128

Quoted 10 lines
drivers/iio/adc/men_z188_adc.c +2 -2
@@ -121,8 +121,8 @@ static int men_z188_probe(struct mcb_device *dev,
          indio_dev->num_channels = ARRAY_SIZE(z188_adc_iio_channels);
 
          mem = mcb_request_mem(dev, "z188-adc");
-       if (!mem)
-               return -ENOMEM;
+       if (IS_ERR(mem))
+               return PTR_ERR(mem);
 
          adc->base = ioremap(mem->start, resource_size(mem));
          if (adc->base == NULL)
Quoted 9 lines
Quoted 6 lines

Or I can pick this up after the merge window has closed if Greg hasn't already taken it.

Jonathan

Did someone actually take this patch, or was it somehow lost?

I've picked it up now and applied it to the fixes-togreg branch of iio.git

Thanks for pointing out I'd forgotten it and sorry about that. I've also marked it for stable.

Quoted 2 lines

Johannes

#5 lore raw
Quoted 34 lines · Jonathan Cameron
Quoted 33 lines · Johannes Thumshirn
Quoted 31 lines · Jonathan Cameron
Quoted 20 lines · johannes thumshirn
Quoted 19 lines · Dan Carpenter

mcb_request_mem() returns an ERR_PTR(), it doesn't return NULL.

Fixes 74aeac4da66f ('iio: adc: Add MEN 16z188 ADC driver')
drivers/iio/adc/men_z188_adc.c +2 -2
index 6989c16..b58d630 100644
@@ -121,8 +121,8 @@ static int men_z188_probe(struct mcb_device *dev,
          indio_dev->num_channels = ARRAY_SIZE(z188_adc_iio_channels);
 
          mem = mcb_request_mem(dev, "z188-adc");
-       if (!mem)
-               return -ENOMEM;
+       if (IS_ERR(mem))
+               return PTR_ERR(mem);
 
Quoted 5 lines

drivers/iio/adc/men_z188_adc.c static int men_z188_probe(struct mcb_device *dev, · line 128

Quoted 2 lines
drivers/iio/adc/men_z188_adc.c +0 -0
          adc->base = ioremap(mem->start, resource_size(mem));
          if (adc->base = NULL)

Or I can pick this up after the merge window has closed if Greg hasn't already taken it.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Jonathan

Did someone actually take this patch, or was it somehow lost?

I've picked it up now and applied it to the fixes-togreg branch of iio.git

Thanks for pointing out I'd forgotten it and sorry about that. I've also marked it for stable.

Thanks a lot