[media] drivers/media/dvb/siano/smscoreapi.c: use list_for_each_entry

Author: Julia Lawall <Julia.Lawall@lip6.fr> Use list_for_each_entry and perform some other induced simplifications. The semantic match that finds the opportunity for this reorganization is as follows: (http://coccinelle.lip6.fr/) // @@ struct list_head *pos; struct list_head *head; statement S; @@ *for (pos = (head)->next; pos != (head); pos = pos->next) S // Signed-off-by: Julia Lawall Signed-off-by: Mauro Carvalho …

Continue reading

arch/x86/kernel/kdebugfs.c: Ensure a consistent return value in error case

Author: Julia Lawall <Julia.Lawall@lip6.fr> Typically, the return value desired for the failure of a function with an integer return value is a negative integer. In these cases, the return value is sometimes a negative integer and sometimes 0, due to a subsequent initialization of the return variable within the loop. A simplified version of the …

Continue reading

can: softing: softing_main: ensure a consistent return value in error case

Author: Julia Lawall <Julia.Lawall@lip6.fr> Typically, the return value desired for the failure of a function with an integer return value is a negative integer. In these cases, the return value is sometimes a negative integer and sometimes 0, due to a subsequent initialization of the return variable within the loop. A simplified version of the …

Continue reading

staging:iio:adis16260: Fix drvdata inconsistency

Author: Lars-Peter Clausen <lars@metafoo.de> The SPI drvdata is set to adis16260_state struct in probe(), but assumed to be the iio_dev struct in remove(). Fix this by setting it to the iio_dev in probe(). The issue has been discovered using the following coccinelle patch: // @r1@ type T; T data; expression dev; @@ ( spi_set_drvdata(dev, (void …

Continue reading

staging:iio:tsl2x7x: Fix client data inconsistency

Author: Lars-Peter Clausen <lars@metafoo.de> In probe the I2C client data is set to the iio_dev struct in probe(), but assumed to be the tsl2X7X_chip struct in remove(). Fix this by reading the client data back as iio_dev as well. The issue has been discovered using the following coccinelle patch: // @r1@ type T; T data; …

Continue reading

staging:iio:lpc32xx_adc: Ensure request_irq and free_irq dev_id parameter match

Author: Lars-Peter Clausen <lars@metafoo.de> The data parameters for request_irq and free_irq have to match, otherwise the IRQ wont be freed. The issue has been discovered using the following coccinelle patch: // @r1@ type T; T data; @@ ( request_irq(…, (void *)data) | request_irq(…, data) | request_threaded_irq(…, (void *)data) | request_threaded_irq(…, data) ) @r2@ type r1.T; …

Continue reading

staging:iio:tsl2x7x: Ensure request_irq and free_irq dev_id parameter match

Author: Lars-Peter Clausen <lars@metafoo.de> The data parameters for request_irq and free_irq have to match, otherwise the IRQ wont be freed. The issue has been discovered using the following coccinelle patch: // @r1@ type T; T data; @@ ( request_irq(…, (void *)data) | request_irq(…, data) | request_threaded_irq(…, (void *)data) | request_threaded_irq(…, data) ) @r2@ type r1.T; …

Continue reading

mtd: spear_smi: failure test for null rather than negative integer

Author: Julia Lawall <Julia.Lawall@lip6.fr> dev_get_platdata returns a pointer, so the failure value would be NULL rather than a negative integer. The semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @@ expression x,e; statement S1,S2; @@ *x = dev_get_platdata(…) … when != x = e *if (x < 0) S1 else S2 // Signed-off-by: Julia …

Continue reading

UBIFS: remove invalid reference to list iterator variable

Author: Julia Lawall <Julia.Lawall@lip6.fr> If list_for_each_entry, etc complete a traversal of the list, the iterator variable ends up pointing to an address at an offset from the list head, and not a meaningful structure. Thus this value should not be used after the end of the iterator. Replace a field access from orphan by NULL …

Continue reading

iommu/tegra: remove invalid reference to list iterator variable

Author: Julia Lawall <Julia.Lawall@lip6.fr> If list_for_each_entry, etc complete a traversal of the list, the iterator variable ends up pointing to an address at an offset from the list head, and not a meaningful structure. Thus this value should not be used after the end of the iterator. Replace c->dev by dev, which is the value …

Continue reading