aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sh_mobile_meram.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-11-21 18:56:58 -0500
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-03-12 17:41:14 -0400
commitcdf88b9072a86545611b9c3f5597ebc47e50ffc1 (patch)
treec3a31efccd11d573334663557171a22dd525eea1 /drivers/video/sh_mobile_meram.c
parent97d16fe69b6499a14a0c85c053f7bef54ce992a4 (diff)
fbdev: sh_mobile_meram: Remove unneeded sanity checks
The meram_register(), meram_unregister() and meram_update() operations check that the pointers they get from the caller are not NULL. Those checks can be remove, as the caller already ensures that the pointers are valid. The platform sanity checks can also be removed, as the operations can't be accessed without valid platform data anyway. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/video/sh_mobile_meram.c')
-rw-r--r--drivers/video/sh_mobile_meram.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
index 2ce0d8f72e31..d9f7a44c231c 100644
--- a/drivers/video/sh_mobile_meram.c
+++ b/drivers/video/sh_mobile_meram.c
@@ -451,21 +451,15 @@ static void *sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
451 unsigned int *pitch) 451 unsigned int *pitch)
452{ 452{
453 struct sh_mobile_meram_fb_cache *cache; 453 struct sh_mobile_meram_fb_cache *cache;
454 struct sh_mobile_meram_priv *priv; 454 struct sh_mobile_meram_priv *priv = pdata->priv;
455 struct platform_device *pdev; 455 struct platform_device *pdev = pdata->pdev;
456 unsigned int out_pitch; 456 unsigned int out_pitch;
457 457
458 if (!pdata || !pdata->priv || !pdata->pdev || !cfg)
459 return ERR_PTR(-EINVAL);
460
461 if (pixelformat != SH_MOBILE_MERAM_PF_NV && 458 if (pixelformat != SH_MOBILE_MERAM_PF_NV &&
462 pixelformat != SH_MOBILE_MERAM_PF_NV24 && 459 pixelformat != SH_MOBILE_MERAM_PF_NV24 &&
463 pixelformat != SH_MOBILE_MERAM_PF_RGB) 460 pixelformat != SH_MOBILE_MERAM_PF_RGB)
464 return ERR_PTR(-EINVAL); 461 return ERR_PTR(-EINVAL);
465 462
466 priv = pdata->priv;
467 pdev = pdata->pdev;
468
469 dev_dbg(&pdev->dev, "registering %dx%d (%s)", xres, yres, 463 dev_dbg(&pdev->dev, "registering %dx%d (%s)", xres, yres,
470 !pixelformat ? "yuv" : "rgb"); 464 !pixelformat ? "yuv" : "rgb");
471 465
@@ -500,16 +494,11 @@ err:
500 return cache; 494 return cache;
501} 495}
502 496
503static int 497static void
504sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data) 498sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
505{ 499{
506 struct sh_mobile_meram_fb_cache *cache = data; 500 struct sh_mobile_meram_fb_cache *cache = data;
507 struct sh_mobile_meram_priv *priv; 501 struct sh_mobile_meram_priv *priv = pdata->priv;
508
509 if (!pdata || !pdata->priv || !data)
510 return -EINVAL;
511
512 priv = pdata->priv;
513 502
514 mutex_lock(&priv->lock); 503 mutex_lock(&priv->lock);
515 504
@@ -521,22 +510,15 @@ sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
521 meram_free(priv, cache); 510 meram_free(priv, cache);
522 511
523 mutex_unlock(&priv->lock); 512 mutex_unlock(&priv->lock);
524
525 return 0;
526} 513}
527 514
528static int 515static void
529sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data, 516sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
530 unsigned long base_addr_y, unsigned long base_addr_c, 517 unsigned long base_addr_y, unsigned long base_addr_c,
531 unsigned long *icb_addr_y, unsigned long *icb_addr_c) 518 unsigned long *icb_addr_y, unsigned long *icb_addr_c)
532{ 519{
533 struct sh_mobile_meram_fb_cache *cache = data; 520 struct sh_mobile_meram_fb_cache *cache = data;
534 struct sh_mobile_meram_priv *priv; 521 struct sh_mobile_meram_priv *priv = pdata->priv;
535
536 if (!pdata || !pdata->priv || !data)
537 return -EINVAL;
538
539 priv = pdata->priv;
540 522
541 mutex_lock(&priv->lock); 523 mutex_lock(&priv->lock);
542 524
@@ -544,8 +526,6 @@ sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
544 meram_get_next_icb_addr(pdata, cache, icb_addr_y, icb_addr_c); 526 meram_get_next_icb_addr(pdata, cache, icb_addr_y, icb_addr_c);
545 527
546 mutex_unlock(&priv->lock); 528 mutex_unlock(&priv->lock);
547
548 return 0;
549} 529}
550 530
551static struct sh_mobile_meram_ops sh_mobile_meram_ops = { 531static struct sh_mobile_meram_ops sh_mobile_meram_ops = {