From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751707AbdJXNzE (ORCPT ); Tue, 24 Oct 2017 09:55:04 -0400 Received: from mail-qk0-f172.google.com ([209.85.220.172]:54220 "EHLO mail-qk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751559AbdJXNzA (ORCPT ); Tue, 24 Oct 2017 09:55:00 -0400 X-Google-Smtp-Source: ABhQp+StFU/hqErgAG3UHe0aX0ddZwHqL8E73HLL0ujJTCtGQEdL8wMgwTDQh69ryY2wLUlQ4i1deQ== Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer() From: Garry Hurley X-Mailer: iPhone Mail (15A432) In-Reply-To: <636f6272-9074-53dc-2c90-cbb4a7cd0901@users.sourceforge.net> Date: Tue, 24 Oct 2017 09:54:58 -0400 Cc: Jani Nikula , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, Joonas Lahtinen , kernel-janitors@vger.kernel.org, LKML , Rodrigo Vivi , Zhi Wang Message-Id: <1A433E6A-DE06-4407-9E33-3CBBA4ADF01B@gmail.com> References: <87efpsiu7r.fsf@intel.com> <636f6272-9074-53dc-2c90-cbb4a7cd0901@users.sourceforge.net> To: SF Markus Elfring Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v9ODt9Sa000405 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 that follows, and what you are taking out is a function call that DOES return execution flow to the calling block. You are replacing it with a goto call which does not return execution flow. The risks of process termination during a goto call make it a bad idea. In this case, the subroutine call is the right move. If the reuse of the error message bothers you, perhaps it is a good candidate for a static string definition, so that if it is changed it can be changed in one location in the code. The tradeoff there is that the static string definition will eat a few bytes of memory from the variable storage. Just my perspective. I could be wrong. Sent from my iPhone On Oct 24, 2017, at 9:17 AM, SF Markus Elfring wrote: >>> 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 you care for the detail how often an error message is stored in the code? > > Regards, > Markus > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel