Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754054AbbGWDF1 (ORCPT ); Wed, 22 Jul 2015 23:05:27 -0400 Received: from mail-bn1bon0139.outbound.protection.outlook.com ([157.56.111.139]:50816 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753643AbbGWDFY convert rfc822-to-8bit (ORCPT ); Wed, 22 Jul 2015 23:05:24 -0400 Authentication-Results: spf=pass (sender IP is 206.191.229.116) smtp.mailfrom=microsoft.com; oracle.com; dkim=none (message not signed) header.d=none; From: Dexuan Cui To: Dan Carpenter CC: Vitaly Kuznetsov , "olaf@aepfle.de" , "pebolle@tiscali.nl" , "gregkh@linuxfoundation.org" , "jasowang@redhat.com" , "driverdev-devel@linuxdriverproject.org" , "linux-kernel@vger.kernel.org" , "stephen@networkplumber.org" , "stefanha@redhat.com" , "netdev@vger.kernel.org" , "apw@canonical.com" , "davem@davemloft.net" Subject: RE: [PATCH V3 3/7] Drivers: hv: vmbus: add APIs to send/recv hvsock packet and get the r/w-ability Thread-Topic: [PATCH V3 3/7] Drivers: hv: vmbus: add APIs to send/recv hvsock packet and get the r/w-ability Thread-Index: AQHQw76VqYGDBjPNEkOE/olvP7hKHJ3nOw2ggAARywCAAQ+KAA== Date: Thu, 23 Jul 2015 03:05:16 +0000 Message-ID: <75f1792c788e418eaddc0d6b7e3381de@SIXPR30MB031.064d.mgd.msft.net> References: <1437476293-6837-1-git-send-email-decui@microsoft.com> <87zj2pk3jf.fsf@vitty.brq.redhat.com> <4538264677374d43961c2d709afb1dd3@SIXPR30MB031.064d.mgd.msft.net> <20150722103546.GO5371@mwanda> In-Reply-To: <20150722103546.GO5371@mwanda> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [141.251.57.196] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD014;1:Bh99/kuqmCZcfP1wljWPWSJ6dpfXIumWA0aPyzVsQ+Pq4EYf36PXvOl+WweDRfxtIZ5y7QHUH0W74DbAZDetxhvdy6F5oT+HjO9v+H7KfqOoq9WpOR5bh+X+aomgtz3iFkA3Iachewrtn/eWIR1LIaojTiqHPEXsz9vY2UugAK9z6tT5qi14QxuQGtVoDObfOm+0Wf7b9cWt2YjHkSkqeaBWcBQ5LQaJdQrShu6LYWzQlDV2vciX9qfiHgTluKGCAthg8i0s7oovJSykfljnLpEY6u0Z3TvU/56VSvfHoIZ9v5zBK1X9K7YCGU900bnWggasW0l+h9Dr+Aze7kspaDKEAEWff7kDU7whK9Oea33j0weKIlPWyftwJIKVYEuq X-Forefront-Antispam-Report: CIP:206.191.229.116;CTRY:US;IPV:CAL;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(438002)(24454002)(189002)(199003)(62966003)(50986999)(23726002)(2656002)(92566002)(97756001)(106116001)(102836002)(24736003)(106466001)(76176999)(46102003)(46406003)(54356999)(2900100001)(33646002)(10090500001)(5001920100001)(19580405001)(2950100001)(5003600100002)(16796002)(50466002)(66066001)(189998001)(5001960100002)(110136002)(6806004)(93886004)(108616004)(86146001)(86362001)(47776003)(87936001)(77156002)(15583001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN1PR03MB071;H:064-smtp-out.microsoft.com;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1PR03MB071;2:U6Lcg2uaivgvrMk4d4IHZLhtY0jYG4FqTv2b6pxhUevEeBjKrLTle5WK9hKw9WE2;3:jG4CkGtud7R56yrFua56OLiP4FdKBLGqB6FepnWCvGEiy3dyvAcMqQ9XlPTe3p4m5tkCYZvHfdBKY9g1RpPt+Skvo6lW+zaqoB2NV2WXD2W5qyI8Z5D6HBmVtdA7x+liYZsYfOBWFUzeXNM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qPjMiIpcAbVkxah7VO56DsPdhBZIVh72tfqKNo60RBbuB6u/za3NaZca/B9XCddx7a5NZ6AhtKNmY5Rb9n/0ru+4E+Ki4xy7CtHIJMlPfVvvVnl4SLwcYECpuJloF0V8Nh7UXC4+ZW4bgrtRh7izUsFgPPABYKPYOsHVvv8y5ZGb+VD61B1wJds6WCtc7a/UWVBw3FO24wQ7IFXEkh69+ElBBFalKGyz2Zv5A9PbWK4pIkYqAW8dk4dmcoWb BN1PR03MB071: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401001)(5005006)(3002001);SRVR:BN1PR03MB071;BCL:0;PCL:0;RULEID:;SRVR:BN1PR03MB071; X-Forefront-PRVS: 06469BCC91 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN1PR03MB071;23:sFjDqSj3Y/jFojbS5mDZhz68W2GthRlIYi7SW/fkgR?= =?us-ascii?Q?CqEPXi/RSK1yGZr7zyJcF/GY7Isc3NMq7gUxt9dOzWIhx8mUJhrUJcp5ONVm?= =?us-ascii?Q?9x4m9ItFppveZQvbVKaDz8qhL3Iq44KT5qEtTePbgX3GqA+IJdUelQY7RiYl?= =?us-ascii?Q?a0PKaRgbLN5cq6yHqZUj+O+VXy+Hb6FutGGKGmMTb6419WzuMRaGP5DmoX3l?= =?us-ascii?Q?yOsFgwx62hyZUJA+bkSOrwibLq5U6llucoNF4Vj22VntbZCJ1Q6q3bU4NruP?= =?us-ascii?Q?kjRqnOoF+t7VQAale3G6PdJFwVGoZhIXyuPEqqqZ/ZP8TEGhQE4aOkjgBisn?= =?us-ascii?Q?s8gdpvaEuI/fBBx5HApF3owDGG7mxv2iTky0MWMfxjcbppGyCDjj3WHdi/ln?= =?us-ascii?Q?nm6IYv5Yl6GH65kv7NVBER5FZhDJI93OjpA7E7ENY0TQ7VJf6V0OlMMwns/l?=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x57p3cbiSq2elH4W8ChpCyP1A2Yv2z+qoZg56aGArOfvAVdPqYq6PAyUiIJ7/Q0XWm9UYeJy/qU8xDAdR/Wg== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2015 03:05:20.2005 (UTC) X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=72f988bf-86f1-41af-91ab-2d7cd011db47;Ip=[206.191.229.116];Helo=[064-smtp-out.microsoft.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR03MB071 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1521 Lines: 51 > From: Dan Carpenter > Sent: Wednesday, July 22, 2015 18:36 > To: Dexuan Cui > On Wed, Jul 22, 2015 at 10:09:10AM +0000, Dexuan Cui wrote: > > > I'd suggest you do something like > > > > > > if (ret == -EAGIAIN) > > > return 0; > > > else if (ret) > > > return ret; > > > > > > to make it future-proof (e.g. when a new error is returned by > > > hv_ringbuffer_peek). And a comment would also be useful as it is unclear > > > why we silence errors here. > > Hi Vitaly, > > Thanks! > > I think I made a mistake here: > > the "if (ret != 0) return 0;" should be changed > > to "if (ret != 0) return ret;" Usually 0 means success to me, so to me, "ret != 0" reads like "ret is not successful" and seems natural. The kind of usage is not rare in the kernel code: decui@lin:~/linux-next$ grep 'if (ret != 0)' kernel/ include/ ipc/ -r | wc -l 28 decui@lin:~/linux-next$ grep 'if (ret != 0)' drivers/ -r | wc -l 1031 > The double negative really doesn't not make the code more complicated. > I like using a quadruple negative instead. > > if (ret != 0 != 0) > return ret; > dan carpenter Hi Dan, I read this as a humor. :-) I'll take the suggestion and remember to use this in V4 and in future: if (ret) return ret; Thanks! -- Dexuan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/