mfd: Fix memory leak in mfd_add_devices()
authorGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 29 Oct 2013 14:47:22 +0000 (15:47 +0100)
committerLee Jones <lee.jones@linaro.org>
Mon, 11 Nov 2013 11:22:17 +0000 (11:22 +0000)
If the first call to mfd_add_device() fails, no child devices have been
registered to the parent yet, and thus mfd_remove_devices() won't find
anything to remove nor free.
Hence the previously allocated array of atomic_t objects will leak.

Free the array instead of calling mfd_remove_devices() on failure during
the first loop iteration to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

No differences found