From patchwork Wed Aug 22 09:22:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Brivio X-Patchwork-Id: 960866 X-Patchwork-Delegate: kadlec@blackhole.kfki.hu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41wMXW330Cz9s5c for ; Wed, 22 Aug 2018 19:23:07 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728380AbeHVMrJ (ORCPT ); Wed, 22 Aug 2018 08:47:09 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42692 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726448AbeHVMrJ (ORCPT ); Wed, 22 Aug 2018 08:47:09 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 540314023ECB; Wed, 22 Aug 2018 09:23:06 +0000 (UTC) Received: from epycfail.redhat.com (ovpn-200-16.brq.redhat.com [10.40.200.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DE422026D74; Wed, 22 Aug 2018 09:23:05 +0000 (UTC) From: Stefano Brivio To: Jozsef Kadlecsik Cc: netfilter-devel@vger.kernel.org Subject: [PATCH ipset 2/4] Simplify return statement in ipset_mnl_query() Date: Wed, 22 Aug 2018 11:22:54 +0200 Message-Id: <8cdcb4bb3baab5297b880382d70dca8645cc6255.1534929327.git.sbrivio@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 22 Aug 2018 09:23:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 22 Aug 2018 09:23:06 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'sbrivio@redhat.com' RCPT:'' Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org As we loop as long as 'ret' is greater than zero, and break only if we get an error in mnl_cb_run2 (with ret <= 0), we can just return ret without checking once more if it's greater than zero. Signed-off-by: Stefano Brivio --- lib/mnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mnl.c b/lib/mnl.c index a0fa66ecdb80..4e075cf94f00 100644 --- a/lib/mnl.c +++ b/lib/mnl.c @@ -115,7 +115,7 @@ ipset_mnl_query(struct ipset_handle *handle, void *buffer, size_t len) ret = mnl_socket_recvfrom(handle->h, buffer, len); D("message received, ret: %d", ret); } - return ret > 0 ? 0 : ret; + return ret; } static struct ipset_handle *