[PATCH] nouveau: kfree() gracefully handles NULL pointers, testingis redundant

From: Jesper Juhl
Date: Wed Mar 14 2012 - 19:52:09 EST


Remove redundant NULL checks before kfree() in
drivers/gpu/drm/nouveau/nvc0_graph.c

Signed-off-by: Jesper Juhl <jj@xxxxxxxxxxxxx>
---
drivers/gpu/drm/nouveau/nvc0_graph.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c
index 8ee3963..e9eca29 100644
--- a/drivers/gpu/drm/nouveau/nvc0_graph.c
+++ b/drivers/gpu/drm/nouveau/nvc0_graph.c
@@ -755,10 +755,8 @@ nvc0_graph_create_fw(struct drm_device *dev, const char *fwname,
static void
nvc0_graph_destroy_fw(struct nvc0_graph_fuc *fuc)
{
- if (fuc->data) {
- kfree(fuc->data);
- fuc->data = NULL;
- }
+ kfree(fuc->data);
+ fuc->data = NULL;
}

static void
@@ -778,8 +776,7 @@ nvc0_graph_destroy(struct drm_device *dev, int engine)
nouveau_gpuobj_ref(NULL, &priv->unk4188b8);
nouveau_gpuobj_ref(NULL, &priv->unk4188b4);

- if (priv->grctx_vals)
- kfree(priv->grctx_vals);
+ kfree(priv->grctx_vals);

NVOBJ_ENGINE_DEL(dev, GR);
kfree(priv);
--
1.7.9.4


--
Jesper Juhl <jj@xxxxxxxxxxxxx> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/