Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp319874iob; Wed, 18 May 2022 02:59:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdIE4P+eXABNe7Bi9oKn+uNYULCkpdn53XPlMZgS4D93QD1X55nvhjfTAgCIqzmoqtFSyD X-Received: by 2002:a05:6a00:cc4:b0:50d:e9db:6145 with SMTP id b4-20020a056a000cc400b0050de9db6145mr27062546pfv.56.1652867944381; Wed, 18 May 2022 02:59:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652867944; cv=none; d=google.com; s=arc-20160816; b=RQBYDBV8Spwdq0kxsHndEAUc0SzXWu+hqHJFxHSuPmhHwiHHYUCIZ2KKdRs2kVfbn9 ECA/kF2DtpiRIyfxkzzOTaFCMA5gcbbwkwMTkfJeEhnTM12bS3tB6V1cD0TZZ9ty/b0h xeK0UdXRvaHp7Wpa8gd+PAhQGCSf6O602FPr35NYEEyNU5H2jUnCs/RcZC++ms9TSFQa GTwT17mEO6X3+Zv6c8wwnnkIoN7SvBDolSx6dAoFGk6D+WQdqjdYuVhzMlKHDtwnW0Zy tevg8spE8YTuWe9rnzp+I1a6yfahAsW4KTbfmqyqDazs8EpoVgWa14HdFvCmTSaRrLuJ t3Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=ucsE3uapS7p1v2bugMuKZHGZtzp/VYWSq/V2Tc8LP0Q=; b=XiGeO+Gh1ArbXTx9R87fADLXgZGY7vtuYDePM+2tuTojU553YtsRdjGf52wqkAojAO JkYd188DyQnlEH4UN+cngiBetw6hzX8Mp+OLnWvacQu6YWDRYRmQzdfsJcJoA2h0E7NE NwCfheAznlLWLvgqBKtfvTf7yU4a3mprOGG0PGQ/C8tQ6tU194iyVBk4v7qO4iLM7AYL yPK8aL1Ok8nmHZ9ZTP7u6OgTUYcR3r0DR51EbjVm1/xTxoa5MPHjAVI13Wh48cgfRLxZ mGzkq32qg/5BtvtO00up3g5bv3pFstT72Ctkj1byVKDI0mBMTJQUMyUjcRZYuEyTwl3X DZWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=WjjzZgjv; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d3-20020a170902f14300b001582d18c33bsi2008871plb.5.2022.05.18.02.59.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 02:59:04 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=WjjzZgjv; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1063D14FC81; Wed, 18 May 2022 02:42:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234483AbiERJmE (ORCPT + 99 others); Wed, 18 May 2022 05:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234510AbiERJkj (ORCPT ); Wed, 18 May 2022 05:40:39 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2719E14C76F for ; Wed, 18 May 2022 02:40:22 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A52901F9CF; Wed, 18 May 2022 09:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1652866820; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ucsE3uapS7p1v2bugMuKZHGZtzp/VYWSq/V2Tc8LP0Q=; b=WjjzZgjv8srVBVMDw/LIsVX2F5t8kzQIJOWwqw+ZKKzgLUUdnJ0FA1FCXdWLqR9T9H7amR q1Al3cteALQzsgYD7Z3g2mpNzslcQJZa/TKEQprWwc8YuXtlhPOa4zv1ao+i5QL7PGlgR4 slgfspmMZVmDESzu/TT8YyLfvTRT838= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1652866820; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ucsE3uapS7p1v2bugMuKZHGZtzp/VYWSq/V2Tc8LP0Q=; b=NKSX849TV7BCsr2i0xjBkAnMqcR8PxpsNIq87IWcf9GC8AO2f02u3FPJrv3QMGFKLWDmKw ayzJM8aZ8x1rCSAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 41D78133F5; Wed, 18 May 2022 09:40:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id xN7yDAO/hGLnEwAAMHmgww (envelope-from ); Wed, 18 May 2022 09:40:19 +0000 Date: Wed, 18 May 2022 11:40:16 +0200 From: Oscar Salvador To: Miaohe Lin Cc: akpm@linux-foundation.org, willy@infradead.org, vbabka@suse.cz, dhowells@redhat.com, neilb@suse.de, apopple@nvidia.com, david@redhat.com, surenb@google.com, peterx@redhat.com, naoya.horiguchi@nec.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 07/15] mm/swap: remove unneeded p != NULL check in __swap_duplicate Message-ID: References: <20220509131416.17553-1-linmiaohe@huawei.com> <20220509131416.17553-8-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220509131416.17553-8-linmiaohe@huawei.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Mon, May 09, 2022 at 09:14:08PM +0800, Miaohe Lin wrote: > If p is NULL, __swap_duplicate will already return -EINVAL. So if we > reach here, p must be non-NULL. > > Signed-off-by: Miaohe Lin Reviewed-by: Oscar Salvador > --- > mm/swapfile.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/mm/swapfile.c b/mm/swapfile.c > index d4b81ca887c0..7b4c99ca2aea 100644 > --- a/mm/swapfile.c > +++ b/mm/swapfile.c > @@ -3336,8 +3336,7 @@ static int __swap_duplicate(swp_entry_t entry, unsigned char usage) > > unlock_out: > unlock_cluster_or_swap_info(p, ci); > - if (p) > - put_swap_device(p); > + put_swap_device(p); > return err; > } > > -- > 2.23.0 > > -- Oscar Salvador SUSE Labs