From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Date: Tue, 24 Oct 2017 14:42:28 +0000 Subject: Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer() Message-Id: <1508856148.1955.12.camel@perches.com> List-Id: References: <87efpsiu7r.fsf@intel.com> <636f6272-9074-53dc-2c90-cbb4a7cd0901@users.sourceforge.net> <1A433E6A-DE06-4407-9E33-3CBBA4ADF01B@gmail.com> <20171024142615.t3y5atz6nulkq55h@mwanda> In-Reply-To: <20171024142615.t3y5atz6nulkq55h@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter , Garry Hurley Cc: intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org, LKML , dri-devel@lists.freedesktop.org, Rodrigo Vivi , intel-gvt-dev@lists.freedesktop.org, SF Markus Elfring 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 readable, > we're making it more convoluted. 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 either as the compiler/linker reuses the repeated string. It might, depending on the compiler, save a few bytes of object code as the compiler may not optimize the repeated call away though. But a good compiler could do that too. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer() Date: Tue, 24 Oct 2017 07:42:28 -0700 Message-ID: <1508856148.1955.12.camel@perches.com> References: <87efpsiu7r.fsf@intel.com> <636f6272-9074-53dc-2c90-cbb4a7cd0901@users.sourceforge.net> <1A433E6A-DE06-4407-9E33-3CBBA4ADF01B@gmail.com> <20171024142615.t3y5atz6nulkq55h@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: In-Reply-To: <20171024142615.t3y5atz6nulkq55h@mwanda> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Dan Carpenter , Garry Hurley Cc: intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org, LKML , dri-devel@lists.freedesktop.org, Rodrigo Vivi , intel-gvt-dev@lists.freedesktop.org, SF Markus Elfring List-Id: dri-devel@lists.freedesktop.org T24gVHVlLCAyMDE3LTEwLTI0IGF0IDE3OjI2ICswMzAwLCBEYW4gQ2FycGVudGVyIHdyb3RlOgo+ IFRoZSBwb2ludCBvZiB1bndpbmQgY29kZSBpcyB0byB1bmRvIHdoYXQgd2FzIGRvbmUgZWFybGll ci4gIElmIGEKPiBmdW5jdGlvbiBhbGxvY2F0ZXMgYSBsaXN0IG9mIHRoaW5ncywgdXNpbmcgc3Rh bmRhcmQgdW53aW5kIHN0eWxlIG1ha2VzCj4gaXQgc2ltcGxlciwgc2FmZXIgYW5kIG1vcmUgcmVh ZGFibGUuCj4gCj4gVGhpcyBpc24ndCB0aGUgY2FzZSBoZXJlLiAgSW5zdGVhZCBvZiBtYWtpbmcg dGhlIGNvZGUgbW9yZSByZWFkYWJsZSwKPiB3ZSdyZSBtYWtpbmcgaXQgbW9yZSBjb252b2x1dGVk LiAgSXQncyBqdXN0IHRoYXQgdHdvIG91dCBvZiB0aHJlZSBlcnJvcgo+IG1lc3NhZ2VzIGhhcHBl bmVkIHRvIGJlIHRoZSBzYW1lIGFuZCBNYXJrdXMgd2FudHMgdG8gc2F2ZSBhIGJpdCBvZgo+IG1l bW9yeSBieSB1c2luZyB0aGUgc2FtZSBzdHJpbmcuICBUaGUgbWVtb3J5IHNhdmluZ3MgaXMgbm90 IHNvIGJpZyB0aGF0Cj4gaXQncyB3b3J0aCBtYWtpbmcgdGhlIGNvZGUgbGVzcyByZWFkYWJsZS4K CkkgYWdyZWUgd2l0aCBEYW4uCgpJdCBkb2Vzbid0IHNhdmUgYW55IHJlYWwgbWVtb3J5IGVpdGhl ciBhcyB0aGUgY29tcGlsZXIvbGlua2VyCnJldXNlcyB0aGUgcmVwZWF0ZWQgc3RyaW5nLgoKSXQg bWlnaHQsIGRlcGVuZGluZyBvbiB0aGUgY29tcGlsZXIsIHNhdmUgYSBmZXcgYnl0ZXMgb2YKb2Jq ZWN0IGNvZGUgYXMgdGhlIGNvbXBpbGVyIG1heSBub3Qgb3B0aW1pemUgdGhlIHJlcGVhdGVkCmNh bGwgYXdheSB0aG91Z2guICBCdXQgYSBnb29kIGNvbXBpbGVyIGNvdWxkIGRvIHRoYXQgdG9vLgpf X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwpJbnRlbC1nZngg bWFpbGluZyBsaXN0CkludGVsLWdmeEBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751759AbdJXOmi (ORCPT ); Tue, 24 Oct 2017 10:42:38 -0400 Received: from smtprelay0177.hostedemail.com ([216.40.44.177]:49686 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751318AbdJXOmc (ORCPT ); Tue, 24 Oct 2017 10:42:32 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:973:981:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3871:3872:3874:4321:5007:7903:8660:9010:9707:10004:10400:10848:11232:11658:11914:12114:12740:12760:12895:13069:13148:13230:13255:13311:13357:13439:14096:14097:14659:21080:21433:21434:21627:30012:30054:30055:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: actor69_15c49cc3ccc31 X-Filterd-Recvd-Size: 2227 Message-ID: <1508856148.1955.12.camel@perches.com> Subject: Re: drm/i915/gvt: Use common error handling code in shadow_workload_ring_buffer() From: Joe Perches To: Dan Carpenter , Garry Hurley Cc: SF Markus Elfring , 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 Date: Tue, 24 Oct 2017 07:42:28 -0700 In-Reply-To: <20171024142615.t3y5atz6nulkq55h@mwanda> References: <87efpsiu7r.fsf@intel.com> <636f6272-9074-53dc-2c90-cbb4a7cd0901@users.sourceforge.net> <1A433E6A-DE06-4407-9E33-3CBBA4ADF01B@gmail.com> <20171024142615.t3y5atz6nulkq55h@mwanda> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 readable, > we're making it more convoluted. 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 either as the compiler/linker reuses the repeated string. It might, depending on the compiler, save a few bytes of object code as the compiler may not optimize the repeated call away though. But a good compiler could do that too.