Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1899313rwi; Tue, 1 Nov 2022 00:58:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5rXmscFsZlxTS4Kv2lJxQjPa/OjQ8IEpWOsAE5CqRVnFy7m3JxxkNL0fPsNkRtOcZEw6Mf X-Received: by 2002:a05:6a00:174f:b0:56d:aa3d:d49b with SMTP id j15-20020a056a00174f00b0056daa3dd49bmr5060353pfc.68.1667289480577; Tue, 01 Nov 2022 00:58:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667289480; cv=none; d=google.com; s=arc-20160816; b=echFtK0QUkk7U9oARsz1EaEc/LfPGhCNDsPRQBel37BAugtGlS/Shc9sC7IQEuTR8i MoxglnhE7AaNg56HHRnDsLxu6su1oJRiJZ/Vh3fzJgU1dnkl3g0i7Ihw6xRVBSij6p0o NcW7ZtFmAAB8jdmcePXhBfD0m3ia0Q8p54abhyPlrDwXZuv/hFxbKz/P/juh1sVK3xky DIDGNBipI/T4VdVZw32jeDZC3AtP/QCzynn2pTh4Mbs6eDOAZUxLZkefQuVTMnKJfZw4 /GvCsYrOHjXDCK43pj0gyrfeTRU+a6Y05DOzVKtzwOTHSV/wNLESW+qEOmym+JUiBACn R4pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/scyIPaJv7qVvjBPhsSoD7DikDGrxiZfHb4+iyUbI4c=; b=ChL0ju1C1nu9Vrzq3fItVpcG0mTaA+r/83yKWgmflMft9V6OgAaXpthUCNQXcMeis7 AVADbeQ1yIkh+c2rMPE5wpwRbh6xQZJOhL6/7g+3Xw3eVBNCJLbA35N/lLgpNMZNDok5 9xZa5UqzXR+GK02ZVHvX7Y2n1qVKUXVmv4WtIAQdAdGA+OkpQReZTdZe6o6l3m7nHiAQ 3L0n5nfGt/vHHOCROprcTilNISe8prOTDoaurc7WFucDAn6NwlfOrjliBiLZwkNlac1X btRF/VI2i5tu4xheCDKbIl3+CtnhqGqqK/QIK2JOiCm5l/S15HtFI6OHOos9lzAl7whT HaUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kbPVrtFS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020a056a000c8300b0056d7aaaf1eesi7129421pfv.122.2022.11.01.00.57.20; Tue, 01 Nov 2022 00:58:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kbPVrtFS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbiKAHaE (ORCPT + 97 others); Tue, 1 Nov 2022 03:30:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbiKAHaC (ORCPT ); Tue, 1 Nov 2022 03:30:02 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC37B15704; Tue, 1 Nov 2022 00:30:00 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id s196so12741697pgs.3; Tue, 01 Nov 2022 00:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/scyIPaJv7qVvjBPhsSoD7DikDGrxiZfHb4+iyUbI4c=; b=kbPVrtFSBxjGCOPh2ADxUrv+QfxgI+QlkyvOtkOPzyygPic8ltO0KoYOMDxFWUfLyw HL6B9SngK2XZZtCP4RN/tAD4JVEYfdC1Zibf36q6BBZwOsp5KPS9Qj05NUVMtZQkgyCV /3elH4fJp35qbwUcjYoZBdHTecv8VzABYr7GcYVwnAuf6MhJW/v04fKT6GCMqCq+GuYn Rrit8nSZF7O36GRtXBMCeANPfKlh4lEBIMepiKA8MWAzz9wrnKAuPNwc1Hlzia1Cr9io GWb+mDkSsOh460WEv/F4BJxSGByFtOUd5bDBSlXzUrjgfWx5fT5l+coZOxr/FZ53kQHZ djug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/scyIPaJv7qVvjBPhsSoD7DikDGrxiZfHb4+iyUbI4c=; b=hUAP9ob4P3UemaZhzqYTvD8XVg/TEXnwBPsoFf9xNVW3oO6naD8kwS1TShIZbB/Pxi naqS2VE1E20TCKrEmFqthRerzkBL8hk0vtFqejluS8nVl1tc629iXa5ObUy9oSkDF7mU QWDDHfYhOCMGCyrMVcVr9Zqnd1zvB6cO8EfHTgq/2v5m66KGNpI2338K2IsSov7I8HXE YNp86tDcCiSVn2F+KFVChKhB6CuI7LxQPiI8i8Thbux5NF30J9NNOXLNfIc6YRML1nNx nKM5E509Z1jsXkSzfcjH7UhrQjtehuxZhMKEipCV3IxfTeH1Hkm48HlQGcUiyxGk0miW Yu2w== X-Gm-Message-State: ACrzQf2xCJ8djouCkgrVmc1CkSfNXVk5jt/C6cvb/bUalaNCG1rTFPSE J6cSdJh3moTcsSsuk0QlLcMNTyOTa5ETbcom X-Received: by 2002:a05:6a00:2315:b0:56d:a084:a77d with SMTP id h21-20020a056a00231500b0056da084a77dmr5795963pfh.53.1667287800210; Tue, 01 Nov 2022 00:30:00 -0700 (PDT) Received: from localhost.localdomain ([43.132.98.40]) by smtp.gmail.com with ESMTPSA id y4-20020aa79e04000000b0056c0d129edfsm5779133pfq.121.2022.11.01.00.29.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 01 Nov 2022 00:29:59 -0700 (PDT) From: korantwork@gmail.com To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, Xinghui Li Subject: [PATCH] io_uring: fix two assignments in if conditions Date: Tue, 1 Nov 2022 15:29:56 +0800 Message-Id: <20221101072956.13028-1-korantwork@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xinghui Li Fixs two error: "ERROR: do not use assignment in if condition #130: FILE: io_uring/net.c:130: + if (!(issue_flags & IO_URING_F_UNLOCKED) && ERROR: do not use assignment in if condition #599: FILE: io_uring/poll.c:599: + } else if (!(issue_flags & IO_URING_F_UNLOCKED) &&" reported by checkpatch.pl in net.c and poll.c . Signed-off-by: Xinghui Li --- io_uring/net.c | 16 +++++++++------- io_uring/poll.c | 7 ++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/io_uring/net.c b/io_uring/net.c index 15dea91625e2..cbd655c88499 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -127,13 +127,15 @@ static struct io_async_msghdr *io_msg_alloc_async(struct io_kiocb *req, struct io_cache_entry *entry; struct io_async_msghdr *hdr; - if (!(issue_flags & IO_URING_F_UNLOCKED) && - (entry = io_alloc_cache_get(&ctx->netmsg_cache)) != NULL) { - hdr = container_of(entry, struct io_async_msghdr, cache); - hdr->free_iov = NULL; - req->flags |= REQ_F_ASYNC_DATA; - req->async_data = hdr; - return hdr; + if (!(issue_flags & IO_URING_F_UNLOCKED)) { + entry = io_alloc_cache_get(&ctx->netmsg_cache); + if (entry != NULL) { + hdr = container_of(entry, struct io_async_msghdr, cache); + hdr->free_iov = NULL; + req->flags |= REQ_F_ASYNC_DATA; + req->async_data = hdr; + return hdr; + } } if (!io_alloc_async_data(req)) { diff --git a/io_uring/poll.c b/io_uring/poll.c index 0d9f49c575e0..e1cb81cca44c 100644 --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -596,9 +596,10 @@ static struct async_poll *io_req_alloc_apoll(struct io_kiocb *req, if (req->flags & REQ_F_POLLED) { apoll = req->apoll; kfree(apoll->double_poll); - } else if (!(issue_flags & IO_URING_F_UNLOCKED) && - (entry = io_alloc_cache_get(&ctx->apoll_cache)) != NULL) { - apoll = container_of(entry, struct async_poll, cache); + } else if (!(issue_flags & IO_URING_F_UNLOCKED)) { + entry = io_alloc_cache_get(&ctx->apoll_cache); + if (entry != NULL) + apoll = container_of(entry, struct async_poll, cache); } else { apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC); if (unlikely(!apoll)) -- 2.36.1