Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cdf88b90 authored by Laurent Pinchart's avatar Laurent Pinchart
Browse files

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
parent 97d16fe6
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -1072,14 +1072,11 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,


	if (ch->meram) {
	if (ch->meram) {
		struct sh_mobile_meram_info *mdev;
		struct sh_mobile_meram_info *mdev;
		int ret;


		mdev = priv->meram_dev;
		mdev = priv->meram_dev;
		ret = mdev->ops->meram_update(mdev, ch->meram,
		mdev->ops->meram_update(mdev, ch->meram,
					base_addr_y, base_addr_c,
					base_addr_y, base_addr_c,
					&base_addr_y, &base_addr_c);
					&base_addr_y, &base_addr_c);
		if (ret)
			return ret;
	}
	}


	ch->base_addr_y = base_addr_y;
	ch->base_addr_y = base_addr_y;
+6 −26
Original line number Original line Diff line number Diff line
@@ -451,21 +451,15 @@ static void *sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
				      unsigned int *pitch)
				      unsigned int *pitch)
{
{
	struct sh_mobile_meram_fb_cache *cache;
	struct sh_mobile_meram_fb_cache *cache;
	struct sh_mobile_meram_priv *priv;
	struct sh_mobile_meram_priv *priv = pdata->priv;
	struct platform_device *pdev;
	struct platform_device *pdev = pdata->pdev;
	unsigned int out_pitch;
	unsigned int out_pitch;


	if (!pdata || !pdata->priv || !pdata->pdev || !cfg)
		return ERR_PTR(-EINVAL);

	if (pixelformat != SH_MOBILE_MERAM_PF_NV &&
	if (pixelformat != SH_MOBILE_MERAM_PF_NV &&
	    pixelformat != SH_MOBILE_MERAM_PF_NV24 &&
	    pixelformat != SH_MOBILE_MERAM_PF_NV24 &&
	    pixelformat != SH_MOBILE_MERAM_PF_RGB)
	    pixelformat != SH_MOBILE_MERAM_PF_RGB)
		return ERR_PTR(-EINVAL);
		return ERR_PTR(-EINVAL);


	priv = pdata->priv;
	pdev = pdata->pdev;

	dev_dbg(&pdev->dev, "registering %dx%d (%s)", xres, yres,
	dev_dbg(&pdev->dev, "registering %dx%d (%s)", xres, yres,
		!pixelformat ? "yuv" : "rgb");
		!pixelformat ? "yuv" : "rgb");


@@ -500,16 +494,11 @@ err:
	return cache;
	return cache;
}
}


static int
static void
sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
{
{
	struct sh_mobile_meram_fb_cache *cache = data;
	struct sh_mobile_meram_fb_cache *cache = data;
	struct sh_mobile_meram_priv *priv;
	struct sh_mobile_meram_priv *priv = pdata->priv;

	if (!pdata || !pdata->priv || !data)
		return -EINVAL;

	priv = pdata->priv;


	mutex_lock(&priv->lock);
	mutex_lock(&priv->lock);


@@ -521,22 +510,15 @@ sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
	meram_free(priv, cache);
	meram_free(priv, cache);


	mutex_unlock(&priv->lock);
	mutex_unlock(&priv->lock);

	return 0;
}
}


static int
static void
sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
		       unsigned long base_addr_y, unsigned long base_addr_c,
		       unsigned long base_addr_y, unsigned long base_addr_c,
		       unsigned long *icb_addr_y, unsigned long *icb_addr_c)
		       unsigned long *icb_addr_y, unsigned long *icb_addr_c)
{
{
	struct sh_mobile_meram_fb_cache *cache = data;
	struct sh_mobile_meram_fb_cache *cache = data;
	struct sh_mobile_meram_priv *priv;
	struct sh_mobile_meram_priv *priv = pdata->priv;

	if (!pdata || !pdata->priv || !data)
		return -EINVAL;

	priv = pdata->priv;


	mutex_lock(&priv->lock);
	mutex_lock(&priv->lock);


@@ -544,8 +526,6 @@ sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
	meram_get_next_icb_addr(pdata, cache, icb_addr_y, icb_addr_c);
	meram_get_next_icb_addr(pdata, cache, icb_addr_y, icb_addr_c);


	mutex_unlock(&priv->lock);
	mutex_unlock(&priv->lock);

	return 0;
}
}


static struct sh_mobile_meram_ops sh_mobile_meram_ops = {
static struct sh_mobile_meram_ops sh_mobile_meram_ops = {
+7 −8
Original line number Original line Diff line number Diff line
@@ -49,12 +49,11 @@ struct sh_mobile_meram_ops {
				unsigned int *pitch);
				unsigned int *pitch);


	/* unregister usage of meram */
	/* unregister usage of meram */
	int (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
	void (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
				 void *data);
				 void *data);


	/* update meram settings */
	/* update meram settings */
	int (*meram_update)(struct sh_mobile_meram_info *meram_dev,
	void (*meram_update)(struct sh_mobile_meram_info *meram_dev, void *data,
			    void *data,
			     unsigned long base_addr_y,
			     unsigned long base_addr_y,
			     unsigned long base_addr_c,
			     unsigned long base_addr_c,
			     unsigned long *icb_addr_y,
			     unsigned long *icb_addr_y,