linux/drivers/ata
Julia Lawall a081da630d drivers/ata/sata_dwc_460ex.c: add missing kfree
Currently, error handling code in this function calls the function
sata_dwc_port_stop, but this function has essentially no effect if hsdevp
has not been stored in ap, which is the case throughout this function.  The
only effect is to print a debugging message including ap->print_id.

The code is rewritten to not call sata_dwc_port_stop, but instead to jump
to a local label that prints the original error message and the print_id
information.  In the case where hsdevp has been already allocated (but not
yet stored in ap), this value is freed as well.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@exists@
local idexpression x;
statement S,S1;
expression E;
identifier fl;
expression *ptr != NULL;
@@

x = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
     when != if (...) { <+...kfree(x)...+> }
     when any
     when != true x == NULL
x->fl
...>
(
if (x == NULL) S1
|
if (...) { ... when != x
               when forall
(
 return \(0\|<+...x...+>\|ptr\);
|
* return ...;
)
}
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2011-08-18 23:58:11 -04:00
..
acard-ahci.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
ahci_platform.c libata: reimplement link power management 2010-10-21 20:21:04 -04:00
ahci.c ahci: RAID-mode SATA patch for Intel Panther Point DeviceIDs 2011-07-23 18:04:32 -04:00
ahci.h ahci: move ahci_sb600_softreset to libahci.c and rename it 2011-07-23 17:57:36 -04:00
ata_generic.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
ata_piix.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
Kconfig ata: Add iMX pata support 2011-08-18 23:57:58 -04:00
libahci.c ahci: move ahci_sb600_softreset to libahci.c and rename it 2011-07-23 17:57:36 -04:00
libata-acpi.c Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 2011-08-02 21:17:02 -10:00
libata-core.c libata: report link resume failure as KERN_WARNING instead of ERR 2011-07-23 18:02:51 -04:00
libata-eh.c libata: leave port thawed after reset failure 2011-07-23 17:57:36 -04:00
libata-pmp.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
libata-scsi.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
libata-sff.c [libata] Prevent warning during PMP error recovery 2011-07-23 18:05:14 -04:00
libata-transport.c drivers/ata/libata-transport.c: include linux/slab.h 2010-10-21 20:21:04 -04:00
libata-transport.h [libata] Add ATA transport class 2010-10-21 20:21:03 -04:00
libata.h libata: plumb sas port scan into standard libata paths 2011-03-02 02:36:45 -05:00
Makefile ata: Add iMX pata support 2011-08-18 23:57:58 -04:00
pata_acpi.c ata: remove unnecessary code 2011-07-23 18:07:27 -04:00
pata_ali.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
pata_amd.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_arasan_cf.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_artop.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_at32.c libata: remove ATA_FLAG_MMIO 2011-03-02 02:36:46 -05:00
pata_at91.c pata_at91: SMC settings calculation bugfixes, support for t6z and IORDY 2011-05-14 15:00:13 -04:00
pata_atiixp.c
pata_atp867x.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_bf54x.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
pata_cmd64x.c pata_cm64x: fix boot crash on parisc 2011-05-14 14:59:15 -04:00
pata_cmd640.c pata_cmd640: implement sff_irq_check() method 2010-10-21 20:21:05 -04:00
pata_cs5520.c ata: Convert dev_printk(KERN_<LEVEL> to dev_<level>( 2011-07-23 17:57:36 -04:00
pata_cs5530.c
pata_cs5535.c
pata_cs5536.c pata_cs5536: avoid implicit MSR API inclusion on x86-64 2010-12-26 19:42:15 -05:00
pata_cypress.c
pata_efar.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_hpt3x2n.c ata: pata: Convert pr_*(DRV_NAME ...) to pr_fmt/pr_<level> 2011-03-14 02:56:31 -04:00
pata_hpt3x3.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_hpt37x.c ata: pata: Convert pr_*(DRV_NAME ...) to pr_fmt/pr_<level> 2011-03-14 02:56:31 -04:00
pata_hpt366.c ata: pata: Convert pr_*(DRV_NAME ...) to pr_fmt/pr_<level> 2011-03-14 02:56:31 -04:00
pata_icside.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
pata_imx.c ata: Add iMX pata support 2011-08-18 23:57:58 -04:00
pata_isapnp.c
pata_it821x.c pata_it821x: Fix RAID type display, by adding missing comma 2011-07-23 18:04:25 -04:00
pata_it8213.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_ixp4xx_cf.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_jmicron.c
pata_legacy.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
pata_macio.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
pata_marvell.c pata_marvell: Add support for 88SE91A0, 88SE91A4 2011-06-24 02:07:35 -04:00
pata_mpc52xx.c dt: Eliminate of_platform_{,un}register_driver 2011-02-28 13:22:46 -07:00
pata_mpiix.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_netcell.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_ninja32.c [libata] trivial: trim trailing whitespace for drivers/ata/*.[ch] 2011-03-02 02:36:45 -05:00
pata_ns87410.c ata: Convert dev_printk(KERN_<LEVEL> to dev_<level>( 2011-07-23 17:57:36 -04:00
pata_ns87415.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_octeon_cf.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_of_platform.c dt: Eliminate of_platform_{,un}register_driver 2011-02-28 13:22:46 -07:00
pata_oldpiix.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_opti.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_optidma.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_palmld.c Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6 into devel-stable 2011-03-26 10:03:03 +00:00
pata_pcmcia.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
pata_pdc202xx_old.c pata_pdc202xx_old: implement sff_irq_check() method 2010-10-21 20:21:06 -04:00
pata_pdc2027x.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_piccolo.c
pata_platform.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
pata_pxa.c libata: remove ATA_FLAG_MMIO 2011-03-02 02:36:46 -05:00
pata_qdi.c
pata_radisys.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_rb532_cf.c drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
pata_rdc.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_rz1000.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_samsung_cf.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
pata_sc1200.c
pata_scc.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_sch.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_serverworks.c
pata_sil680.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_sis.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_sl82c105.c ata: Convert dev_printk(KERN_<LEVEL> to dev_<level>( 2011-07-23 17:57:36 -04:00
pata_triflex.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
pata_via.c pata_via: disable ATAPI DMA on AVERATEC 3200 2011-08-18 23:56:39 -04:00
pdc_adma.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sata_dwc_460ex.c drivers/ata/sata_dwc_460ex.c: add missing kfree 2011-08-18 23:58:11 -04:00
sata_fsl.c ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> 2011-07-23 17:57:36 -04:00
sata_inic162x.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sata_mv.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sata_nv.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sata_promise.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sata_promise.h
sata_qstor.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sata_sil24.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sata_sil.c [libata] sata_sil: fix used-uninit warning 2011-08-18 23:52:36 -04:00
sata_sis.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sata_svw.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sata_sx4.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sata_uli.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sata_via.c ata: sata_via: Use dev_dbg 2011-07-23 17:57:36 -04:00
sata_vsc.c ata: Add and use ata_print_version_once 2011-07-23 17:57:36 -04:00
sis.h