drm/radeon: Avoid NULL pointer dereference from atom_index_iio() allocation failure
authorTim Gardner <tim.gardner@canonical.com>
Mon, 11 Feb 2013 21:34:32 +0000 (14:34 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 20 Feb 2013 13:51:19 +0000 (08:51 -0500)
commit0e34d0945ed16aeb72c863be4efe4cd0c62f9c53
treeacc055d3c3fd2c4ec2972b7d5d16a729097e670f
parentc944b2abb067130542055666f23409fd5e1afc8e
drm/radeon: Avoid NULL pointer dereference from atom_index_iio() allocation failure

Smatch anlysis:

drivers/gpu/drm/radeon/atom.c:1242 atom_index_iio() error: potential null
 dereference 'ctx->iio'.  (kzalloc returns null)

Also cleaned up some checks before calls to kfree(). kfree(NULL) is OK.

Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Michel Dänzer" <michel.daenzer@amd.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/atom.c
drivers/gpu/drm/radeon/radeon_device.c