On Tue, Sep 10, 2013 at 07:36:45PM -0300, Rodrigo Vivi wrote:
> From: Ben Widawsky <[email protected]>
> 
> The buf pointer used during l3_write is just char *, therefore it does
> not require the silly /4.
> 
> Signed-off-by: Ben Widawsky <[email protected]>
> Signed-off-by: Rodrigo Vivi <[email protected]>
> ---
>  drivers/gpu/drm/i915/i915_sysfs.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c 
> b/drivers/gpu/drm/i915/i915_sysfs.c
> index 05195c0..70de7a9 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -184,9 +184,7 @@ i915_l3_write(struct file *filp, struct kobject *kobj,
>       if (temp)
>               dev_priv->l3_parity.remap_info = temp;
>  
> -     memcpy(dev_priv->l3_parity.remap_info + (offset/4),
> -            buf + (offset/4),
> -            count);
> +     memcpy(dev_priv->l3_parity.remap_info + (offset/4), buf, count);

The commit message doesn't really reflect the fact that you completely
remove the offset from 'buf', which is actually the correct thing to do,
but the commit message should match the patch.

Also i915_l3_read() should get the same fix.

And while on the subject, I don't understand why we're playing weird
tricks with the remap_info memory allocation. Ie. why don't we simply
do this?

 ...
 if (!dev_priv->l3_parity.remap_info) {
        dev_priv->l3_parity.remap_info = kzalloc(GEN7_L3LOG_SIZE,
                                                 GFP_KERNEL);

        if (!dev_priv->l3_parity.remap_info) {
                mutex_unlock(&drm_dev->struct_mutex);
                return -ENOMEM;
        }
 }
 ...

>  
>       i915_gem_l3_remap(drm_dev);
>  
> -- 
> 1.8.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to