NFC: st21nfca: Fix potential memory leak
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 19 Feb 2017 09:58:47 +0000 (10:58 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Sat, 1 Apr 2017 22:18:35 +0000 (00:18 +0200)
commit8f79ded95934154d4454b6e422a18a3fbcd7a268
tree3fd1d1aaf10da2b3301deca7f117a2f0426deb42
parentca42fb9e52d155547e6cf18cf26bce3e1a6af4ea
NFC: st21nfca: Fix potential memory leak

If all bits of 'dev_mask' are already set, there is a memory leak because
'info' should be freed before returning.

While fixing it, 'return -ENOMEM' directly if the first kzalloc fails.
This makes the code more readable.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/st21nfca/core.c