diff options
author | Joe Perches <joe@perches.com> | 2013-02-11 09:41:29 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-11 10:10:33 -0800 |
commit | 78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b (patch) | |
tree | 6534f66eb765163602ad1af98c651bea6ae09416 /drivers/staging/omapdrm | |
parent | ad463ac42771a0bb8a706cf8a985788fe5f5c1c6 (diff) | |
download | op-kernel-dev-78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b.zip op-kernel-dev-78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b.tar.gz |
staging: Remove unnecessary OOM messages
alloc failures already get standardized OOM
messages and a dump_stack.
For the affected mallocs around these OOM messages:
Converted kzallocs with multiplies to kcalloc.
Converted kmallocs with multiplies to kmalloc_array.
Converted a kmalloc/strlen/strncpy to kstrdup.
Moved a spin_lock below a removed OOM message and
removed a now unnecessary spin_unlock.
Neatened alignment and whitespace.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/omapdrm')
-rw-r--r-- | drivers/staging/omapdrm/omap_connector.c | 4 | ||||
-rw-r--r-- | drivers/staging/omapdrm/omap_crtc.c | 5 | ||||
-rw-r--r-- | drivers/staging/omapdrm/omap_dmm_tiler.c | 13 | ||||
-rw-r--r-- | drivers/staging/omapdrm/omap_drv.c | 4 | ||||
-rw-r--r-- | drivers/staging/omapdrm/omap_encoder.c | 4 | ||||
-rw-r--r-- | drivers/staging/omapdrm/omap_fb.c | 1 | ||||
-rw-r--r-- | drivers/staging/omapdrm/omap_fbdev.c | 4 | ||||
-rw-r--r-- | drivers/staging/omapdrm/omap_gem.c | 10 | ||||
-rw-r--r-- | drivers/staging/omapdrm/omap_plane.c | 4 |
9 files changed, 13 insertions, 36 deletions
diff --git a/drivers/staging/omapdrm/omap_connector.c b/drivers/staging/omapdrm/omap_connector.c index 4cc9ee7..8979c80 100644 --- a/drivers/staging/omapdrm/omap_connector.c +++ b/drivers/staging/omapdrm/omap_connector.c @@ -261,10 +261,8 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, omap_dss_get_device(dssdev); omap_connector = kzalloc(sizeof(struct omap_connector), GFP_KERNEL); - if (!omap_connector) { - dev_err(dev->dev, "could not allocate connector\n"); + if (!omap_connector) goto fail; - } omap_connector->dssdev = dssdev; omap_connector->encoder = encoder; diff --git a/drivers/staging/omapdrm/omap_crtc.c b/drivers/staging/omapdrm/omap_crtc.c index 5c6ed60..32109c0 100644 --- a/drivers/staging/omapdrm/omap_crtc.c +++ b/drivers/staging/omapdrm/omap_crtc.c @@ -601,11 +601,8 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, DBG("%s", channel_names[channel]); omap_crtc = kzalloc(sizeof(*omap_crtc), GFP_KERNEL); - - if (!omap_crtc) { - dev_err(dev->dev, "could not allocate CRTC\n"); + if (!omap_crtc) goto fail; - } crtc = &omap_crtc->base; diff --git a/drivers/staging/omapdrm/omap_dmm_tiler.c b/drivers/staging/omapdrm/omap_dmm_tiler.c index 3910215..9b794c9 100644 --- a/drivers/staging/omapdrm/omap_dmm_tiler.c +++ b/drivers/staging/omapdrm/omap_dmm_tiler.c @@ -581,10 +581,8 @@ static int omap_dmm_probe(struct platform_device *dev) struct resource *mem; omap_dmm = kzalloc(sizeof(*omap_dmm), GFP_KERNEL); - if (!omap_dmm) { - dev_err(&dev->dev, "failed to allocate driver data section\n"); + if (!omap_dmm) goto fail; - } /* initialize lists */ INIT_LIST_HEAD(&omap_dmm->alloc_head); @@ -681,11 +679,9 @@ static int omap_dmm_probe(struct platform_device *dev) } /* alloc engines */ - omap_dmm->engines = kzalloc( - omap_dmm->num_engines * sizeof(struct refill_engine), - GFP_KERNEL); + omap_dmm->engines = kcalloc(omap_dmm->num_engines, + sizeof(struct refill_engine), GFP_KERNEL); if (!omap_dmm->engines) { - dev_err(&dev->dev, "could not allocate engines\n"); ret = -ENOMEM; goto fail; } @@ -702,10 +698,9 @@ static int omap_dmm_probe(struct platform_device *dev) list_add(&omap_dmm->engines[i].idle_node, &omap_dmm->idle_head); } - omap_dmm->tcm = kzalloc(omap_dmm->num_lut * sizeof(*omap_dmm->tcm), + omap_dmm->tcm = kcalloc(omap_dmm->num_lut, sizeof(*omap_dmm->tcm), GFP_KERNEL); if (!omap_dmm->tcm) { - dev_err(&dev->dev, "failed to allocate lut ptrs\n"); ret = -ENOMEM; goto fail; } diff --git a/drivers/staging/omapdrm/omap_drv.c b/drivers/staging/omapdrm/omap_drv.c index d246f85..480dc34 100644 --- a/drivers/staging/omapdrm/omap_drv.c +++ b/drivers/staging/omapdrm/omap_drv.c @@ -335,10 +335,8 @@ static int dev_load(struct drm_device *dev, unsigned long flags) DBG("load: dev=%p", dev); priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (!priv) { - dev_err(dev->dev, "could not allocate priv\n"); + if (!priv) return -ENOMEM; - } priv->omaprev = pdata->omaprev; diff --git a/drivers/staging/omapdrm/omap_encoder.c b/drivers/staging/omapdrm/omap_encoder.c index e053160..25fc0c7 100644 --- a/drivers/staging/omapdrm/omap_encoder.c +++ b/drivers/staging/omapdrm/omap_encoder.c @@ -147,10 +147,8 @@ struct drm_encoder *omap_encoder_init(struct drm_device *dev, struct omap_encoder *omap_encoder; omap_encoder = kzalloc(sizeof(*omap_encoder), GFP_KERNEL); - if (!omap_encoder) { - dev_err(dev->dev, "could not allocate encoder\n"); + if (!omap_encoder) goto fail; - } omap_encoder->dssdev = dssdev; diff --git a/drivers/staging/omapdrm/omap_fb.c b/drivers/staging/omapdrm/omap_fb.c index 09028e9..bb49699 100644 --- a/drivers/staging/omapdrm/omap_fb.c +++ b/drivers/staging/omapdrm/omap_fb.c @@ -418,7 +418,6 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, omap_fb = kzalloc(sizeof(*omap_fb), GFP_KERNEL); if (!omap_fb) { - dev_err(dev->dev, "could not allocate fb\n"); ret = -ENOMEM; goto fail; } diff --git a/drivers/staging/omapdrm/omap_fbdev.c b/drivers/staging/omapdrm/omap_fbdev.c index 8a027bb..70f2d6e 100644 --- a/drivers/staging/omapdrm/omap_fbdev.c +++ b/drivers/staging/omapdrm/omap_fbdev.c @@ -348,10 +348,8 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) int ret = 0; fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); - if (!fbdev) { - dev_err(dev->dev, "could not allocate fbdev\n"); + if (!fbdev) goto fail; - } INIT_WORK(&fbdev->work, pan_worker); diff --git a/drivers/staging/omapdrm/omap_gem.c b/drivers/staging/omapdrm/omap_gem.c index f9297eb..518d03d 100644 --- a/drivers/staging/omapdrm/omap_gem.c +++ b/drivers/staging/omapdrm/omap_gem.c @@ -1402,10 +1402,8 @@ struct drm_gem_object *omap_gem_new(struct drm_device *dev, } omap_obj = kzalloc(sizeof(*omap_obj), GFP_KERNEL); - if (!omap_obj) { - dev_err(dev->dev, "could not allocate GEM object\n"); + if (!omap_obj) goto fail; - } list_add(&omap_obj->mm_list, &priv->obj_list); @@ -1461,11 +1459,9 @@ void omap_gem_init(struct drm_device *dev) return; } - usergart = kzalloc(3 * sizeof(*usergart), GFP_KERNEL); - if (!usergart) { - dev_warn(dev->dev, "could not allocate usergart\n"); + usergart = kcalloc(3, sizeof(*usergart), GFP_KERNEL); + if (!usergart) return; - } /* reserve 4k aligned/wide regions for userspace mappings: */ for (i = 0; i < ARRAY_SIZE(fmts); i++) { diff --git a/drivers/staging/omapdrm/omap_plane.c b/drivers/staging/omapdrm/omap_plane.c index bb989d7..c063476 100644 --- a/drivers/staging/omapdrm/omap_plane.c +++ b/drivers/staging/omapdrm/omap_plane.c @@ -390,10 +390,8 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, DBG("%s: priv=%d", plane_names[id], private_plane); omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL); - if (!omap_plane) { - dev_err(dev->dev, "could not allocate plane\n"); + if (!omap_plane) goto fail; - } ret = kfifo_alloc(&omap_plane->unpin_fifo, 16, GFP_KERNEL); if (ret) { |