linux/drivers
Jesper Juhl 391a169e99 pohmelfs: remove unneeded conditionals before calls to crypto_destroy_tfm wrappers.
Hi,

crypto_free_hash() and crypto_free_ablkcipher() are just wrappers around
crypto_free_tfm() which is itself just a wrapper around
crypto_destroy_tfm().
Passing crypto_destroy_tfm() a NULL pointer is valid, so there's no reason
to check for NULL first.

Removing the unneeded conditionals (which is what the patch does) brings
us the benefit of having to execute a few fewer test/branch instructions
and also reduces object code size slightly:

before:
   text    data     bss     dec     hex filename
   8630     112    3312   12054    2f16 drivers/staging/pohmelfs/crypto.o

0000000000000cbe <pohmelfs_crypto_engine_exit>:
     cbe:       55                      push   %rbp
     cbf:       48 89 e5                mov    %rsp,%rbp
     cc2:       53                      push   %rbx
     cc3:       48 83 ec 08             sub    $0x8,%rsp
     cc7:       e8 00 00 00 00          callq  ccc <pohmelfs_crypto_engine_exit+0xe>
     ccc:       48 ff 05 00 00 00 00    incq   0x0(%rip)        # cd3 <pohmelfs_crypto_engine_exit+0x15>
     cd3:       48 89 fb                mov    %rdi,%rbx
     cd6:       48 8b 7f 20             mov    0x20(%rdi),%rdi
     cda:       48 85 ff                test   %rdi,%rdi
     cdd:       74 0c                   je     ceb <pohmelfs_crypto_engine_exit+0x2d>
     cdf:       48 ff 05 00 00 00 00    incq   0x0(%rip)        # ce6 <pohmelfs_crypto_engine_exit+0x28>
     ce6:       e8 58 fa ff ff          callq  743 <crypto_free_hash>
     ceb:       48 8b 7b 28             mov    0x28(%rbx),%rdi
     cef:       48 85 ff                test   %rdi,%rdi
     cf2:       75 09                   jne    cfd <pohmelfs_crypto_engine_exit+0x3f>
     cf4:       48 ff 05 00 00 00 00    incq   0x0(%rip)        # cfb <pohmelfs_crypto_engine_exit+0x3d>
     cfb:       eb 16                   jmp    d13 <pohmelfs_crypto_engine_exit+0x55>
     cfd:       48 89 fe                mov    %rdi,%rsi
     d00:       48 ff 05 00 00 00 00    incq   0x0(%rip)        # d07 <pohmelfs_crypto_engine_exit+0x49>
     d07:       e8 00 00 00 00          callq  d0c <pohmelfs_crypto_engine_exit+0x4e>
     d0c:       48 ff 05 00 00 00 00    incq   0x0(%rip)        # d13 <pohmelfs_crypto_engine_exit+0x55>
     d13:       48 8b 7b 18             mov    0x18(%rbx),%rdi
     d17:       e8 00 00 00 00          callq  d1c <pohmelfs_crypto_engine_exit+0x5e>
     d1c:       48 ff 05 00 00 00 00    incq   0x0(%rip)        # d23 <pohmelfs_crypto_engine_exit+0x65>
     d23:       5e                      pop    %rsi
     d24:       5b                      pop    %rbx
     d25:       c9                      leaveq
     d26:       c3                      retq

after:
   text    data     bss     dec     hex filename
   8604     112    3296   12012    2eec drivers/staging/pohmelfs/crypto.o

0000000000000cbe <pohmelfs_crypto_engine_exit>:
     cbe:       55                      push   %rbp
     cbf:       48 89 e5                mov    %rsp,%rbp
     cc2:       53                      push   %rbx
     cc3:       48 83 ec 08             sub    $0x8,%rsp
     cc7:       e8 00 00 00 00          callq  ccc <pohmelfs_crypto_engine_exit+0xe>
     ccc:       48 ff 05 00 00 00 00    incq   0x0(%rip)        # cd3 <pohmelfs_crypto_engine_exit+0x15>
     cd3:       48 89 fb                mov    %rdi,%rbx
     cd6:       48 8b 7f 20             mov    0x20(%rdi),%rdi
     cda:       e8 64 fa ff ff          callq  743 <crypto_free_hash>
     cdf:       48 8b 7b 28             mov    0x28(%rbx),%rdi
     ce3:       48 ff 05 00 00 00 00    incq   0x0(%rip)        # cea <pohmelfs_crypto_engine_exit+0x2c>
     cea:       48 89 fe                mov    %rdi,%rsi
     ced:       e8 00 00 00 00          callq  cf2 <pohmelfs_crypto_engine_exit+0x34>
     cf2:       48 8b 7b 18             mov    0x18(%rbx),%rdi
     cf6:       48 ff 05 00 00 00 00    incq   0x0(%rip)        # cfd <pohmelfs_crypto_engine_exit+0x3f>
     cfd:       e8 00 00 00 00          callq  d02 <pohmelfs_crypto_engine_exit+0x44>
     d02:       48 ff 05 00 00 00 00    incq   0x0(%rip)        # d09 <pohmelfs_crypto_engine_exit+0x4b>
     d09:       5e                      pop    %rsi
     d0a:       5b                      pop    %rbx
     d0b:       c9                      leaveq
     d0c:       c3                      retq

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-09 16:07:08 -08:00
..
accessibility
acpi
amba
ata ATA: pata_octeon_cf: Use I/O clock rate for timing calculations. 2010-10-29 19:08:41 +01:00
atm
auxdisplay
base Merge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6 2010-10-29 15:09:56 -07:00
block floppy: fix another use-after-free 2010-11-06 07:49:56 -07:00
bluetooth
cdrom
char TTY: move .gitignore from drivers/char/ to drivers/tty/vt/ 2010-11-05 22:18:23 -07:00
clocksource ARM: shmobile: remove sh_timer_config clk member 2010-10-31 10:40:39 -04:00
connector
cpufreq
cpuidle
crypto
dca
dio
dma drivers/dma/Kconfig: add part number for Topcliff. 2010-10-29 14:14:02 -07:00
edac
eisa
firewire Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 2010-11-05 14:17:22 -07:00
firmware dmi: log board, system, and BIOS information 2010-10-27 18:03:05 -07:00
gpio gpio: Add VIA VX855 GPIO driver 2010-10-29 00:29:51 +02:00
gpu Merge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 2010-10-27 20:37:06 -07:00
hid
hwmon hwmon: (ltc4261) Fix error message format 2010-11-05 10:17:19 -07:00
i2c i2c-i801: Add PCI idents for Patsburg 'IDF' SMBus controllers 2010-10-31 21:07:00 +01:00
ide
idle
ieee802154
infiniband convert get_sb_single() users 2010-10-29 04:16:28 -04:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2010-10-31 21:02:39 -04:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2010-11-05 15:25:48 -07:00
leds leds-net5501: taints kernel, add license 2010-11-05 09:51:56 -07:00
lguest
macintosh Move ams driver to macintosh 2010-10-28 20:31:50 +02:00
mca
md md: tidy up device searches in read_balance. 2010-10-29 16:40:33 +11:00
media Input: ir-keytable - fix uninitialized variable warning 2010-10-31 21:05:43 -04:00
memstick
message
mfd mfd: Fix a memory leak when unload mc13xxx-core module 2010-10-29 00:30:43 +02:00
misc Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb 2010-10-29 11:49:38 -07:00
mmc mfd: Adding twl6030 mmc card detect support for MMC1 2010-10-29 00:29:59 +02:00
mtd Merge git://git.infradead.org/mtd-2.6 2010-10-30 08:31:35 -07:00
net ipw2x00: remove the right /proc/net entry 2010-11-05 18:57:04 -07:00
nubus
of
oprofile Merge branches 'perf-fixes-for-linus' and 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-10-30 11:43:26 -07:00
parisc Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6 2010-10-28 09:24:14 -07:00
parport
pci Merge branch 'stable/xen-pcifront-0.8.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen 2010-10-28 17:11:17 -07:00
pcmcia
platform Remove duplicate includes from many files 2010-10-27 18:03:18 -07:00
pnp
power power: Revert "power_supply: Mark twl4030_charger as broken" 2010-10-29 00:30:44 +02:00
pps
ps3
rapidio rapidio: fix destructive port EM initialization for Tsi568 2010-10-27 18:03:16 -07:00
regulator regulator: max8998 BUCK1/2 voltage change with use of GPIOs 2010-10-29 00:30:15 +02:00
rtc sh: mach-snapgear: Kill off machtype, consolidate board def. 2010-10-29 19:06:53 +09:00
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2010-10-31 20:43:12 -04:00
sbus
scsi [SCSI] pmcraid: add support for set timestamp command and other fixes 2010-10-29 12:03:01 -05:00
serial Merge branch 'for-linus' of git://www.jni.nu/cris 2010-11-01 07:53:19 -04:00
sfi
sh Merge branches 'sh/pio-death', 'sh/nommu', 'sh/clkfwk', 'sh/core' and 'sh/intc-extension' into sh-fixes-for-linus 2010-11-08 09:42:43 +09:00
sn
spi Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6 2010-11-01 07:50:43 -04:00
ssb
staging pohmelfs: remove unneeded conditionals before calls to crypto_destroy_tfm wrappers. 2010-11-09 16:07:08 -08:00
tc
telephony
thermal
tty TTY: move .gitignore from drivers/char/ to drivers/tty/vt/ 2010-11-05 22:18:23 -07:00
uio
usb Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2010-11-05 15:25:48 -07:00
uwb
vhost
video Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2010-10-30 08:26:25 -07:00
virtio
vlynq
w1 w1: don't allow arbitrary users to remove w1 devices 2010-10-27 18:03:17 -07:00
watchdog WATCHDOG: octeon-wdt: Use I/O clock rate for timing calculations. 2010-10-29 19:08:42 +01:00
xen convert get_sb_single() users 2010-10-29 04:16:28 -04:00
zorro
Kconfig
Makefile TTY: create drivers/tty and move the tty core files there 2010-11-05 08:10:33 -07:00