Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-25 Thread Daniele Nicolodi
On 10/24/17 9:01 AM, SF Markus Elfring wrote: >>> Do you prefer to delegate the proposed software refactoring >>> only to a corresponding optimiser? >> >> yes. > > Will any applications around the semantic patch language > (Coccinelle software) fit also in the preferred tool category? What do you

RE: [PATCH] drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-24 Thread Wang, Zhi A
, 2017 3:26 PM To: dri-devel@lists.freedesktop.org; intel-...@lists.freedesktop.org; intel-gvt-...@lists.freedesktop.org; David Airlie ; Jani Nikula ; Joonas Lahtinen ; Vivi, Rodrigo ; Zhenyu Wang ; Wang, Zhi A Cc: LKML ; kernel-janit...@vger.kernel.org Subject: [PATCH] drm/i915/gvt: Use common

Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-24 Thread SF Markus Elfring
>> Do you prefer to delegate the proposed software refactoring >> only to a corresponding optimiser? > > yes. Will any applications around the semantic patch language (Coccinelle software) fit also in the preferred tool category? Regards, Markus ___ dr

Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-24 Thread Joe Perches
On Tue, 2017-10-24 at 16:51 +0200, SF Markus Elfring wrote: > Do you prefer to delegate the proposed software refactoring > only to a corresponding optimiser? yes. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/m

Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-24 Thread SF Markus Elfring
>> … It's just that two out of three error >> messages happened to be the same and Markus wants to save a bit of >> memory by using the same string. The memory savings is not so big that >> it's worth making the code less readable. > > I agree with Dan. > > It doesn't save any real memory eithe

Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-24 Thread Joe Perches
On Tue, 2017-10-24 at 17:26 +0300, Dan Carpenter wrote: > The point of unwind code is to undo what was done earlier. If a > function allocates a list of things, using standard unwind style makes > it simpler, safer and more readable. > > This isn't the case here. Instead of making the code more

Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-24 Thread SF Markus Elfring
> This isn't the case here. I find your view interesting for further clarification somehow. > Instead of making the code more readable, we're making it more convoluted. Can the shown software refactoring usually help here? > It's just that two out of three error messages happened to be the sa

Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-24 Thread Dan Carpenter
The point of unwind code is to undo what was done earlier. If a function allocates a list of things, using standard unwind style makes it simpler, safer and more readable. This isn't the case here. Instead of making the code more readable, we're making it more convoluted. It's just that two out

Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-24 Thread Garry Hurley
Markus, I normally keep quiet on threads like this. I half agree with you. Yes, perhaps a reportError function would be a good idea, but it seems that what you are suggesting is trading an inline subroutine call for a spaghetti-code vondition. The goto is used only if you do not have any code

Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-24 Thread SF Markus Elfring
>> Add a jump target so that a call of the function "gvt_vgpu_err" is stored >> only once at the end of this function implementation. >> Replace two calls by goto statements. >> >> This issue was detected by using the Coccinelle software. > > I don't think this is an issue or an improvement. Do y

Re: [PATCH] drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-24 Thread Jani Nikula
On Tue, 24 Oct 2017, SF Markus Elfring wrote: > From: Markus Elfring > Date: Tue, 24 Oct 2017 14:20:06 +0200 > > Add a jump target so that a call of the function "gvt_vgpu_err" is stored > only once at the end of this function implementation. > Replace two calls by goto statements. > > This issue

[PATCH] drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer()

2017-10-24 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 24 Oct 2017 14:20:06 +0200 Add a jump target so that a call of the function "gvt_vgpu_err" is stored only once at the end of this function implementation. Replace two calls by goto statements. This issue was detected by using the Coccinelle software. Signed-off-b