From patchwork Wed Feb 21 06:22:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13564961 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77DB1C48BF6 for ; Wed, 21 Feb 2024 06:22:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED0536B007E; Wed, 21 Feb 2024 01:22:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E80086B0085; Wed, 21 Feb 2024 01:22:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D48176B0087; Wed, 21 Feb 2024 01:22:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C04E16B0085 for ; Wed, 21 Feb 2024 01:22:20 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8D62D40812 for ; Wed, 21 Feb 2024 06:22:20 +0000 (UTC) X-FDA: 81814816440.06.E11FC6A Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf30.hostedemail.com (Postfix) with ESMTP id E617380010 for ; Wed, 21 Feb 2024 06:22:18 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=o74Mlav9; spf=pass (imf30.hostedemail.com: domain of dan.carpenter@linaro.org designates 209.85.218.41 as permitted sender) smtp.mailfrom=dan.carpenter@linaro.org; dmarc=pass (policy=none) header.from=linaro.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708496539; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=741qzZnNSG7KtGFvhuK+y/Zf676UMWnlta8zE4AAseE=; b=fWdNIb95R0HHDE0vjUuJ32XqsiD9gzG/ad4/nQe4j9nYwdosl8jr5uPgWrto73SD6CPkUY /ZzOJ25eOqDzp3e2+4XlM+ftPk4N6WYP9/xlirewcxiXEDmYi45E7yclG6BJbzHoAx2VY2 vsUhf8+QCOkmZgQt07TbcIaGB6BRv/A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708496539; a=rsa-sha256; cv=none; b=hvbM612EVj6BARkzEgvy3vVzbBGKgvwIpBwyuh7uo03V9yXilYKzm5Q9bLFgRV9qp0Zu0Q EhRNxEFzpc3VX12/bGE76s1lbIlKzzPTKHPk5UJt744sxfFByqfIIrfXrLDIEkC9XjzrI9 vhqSdCN7I/5qfG4HMdWe9Xw+PiPvWjw= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=o74Mlav9; spf=pass (imf30.hostedemail.com: domain of dan.carpenter@linaro.org designates 209.85.218.41 as permitted sender) smtp.mailfrom=dan.carpenter@linaro.org; dmarc=pass (policy=none) header.from=linaro.org Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a3e891b5e4eso329448566b.0 for ; Tue, 20 Feb 2024 22:22:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708496537; x=1709101337; darn=kvack.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=741qzZnNSG7KtGFvhuK+y/Zf676UMWnlta8zE4AAseE=; b=o74Mlav90TOdiLmSsk+ywwhYvLJKet3zjpdXKKjtn7JjxAbKPxjgRdgkcDXU0Jve5o k9R0u+MxbTbi9TYTRW4tuNuk6AJl6YOhf6rhvx17r1WCh0xWIqJkQii2f1EKRC/2wuB7 KSAjcaE1f/k+ADZOf/nRosxfXIfVbXtpvEdTKYSbThPjAonb/RQFiWpaihrpkR2sEtqE 7HCXdKe3SnXjwm6Hp6a4gc+wlsKkb91O8iIpCl47TMVzY5L9gOAn07Rovpt0YF+Jg2MG C1le1TLpN+lvG15OUdzJ0LF3pixN/hbIr5xQ516hCNxrE/GUt9sHJVXHuX4v24X5Ybns UdkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708496537; x=1709101337; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=741qzZnNSG7KtGFvhuK+y/Zf676UMWnlta8zE4AAseE=; b=hAn3VXCvxPI8ao3I5hPV90jkglbiJlqVL2W3wNKlViE9ROu7ZU/N7Rxv876rVXWqXU pypivSmu2txW66QhghygHwKdLlyhPI3/Ga/eUnypMfqkYAg1Hfiu+M3Cwx4kIw4ypiHp sctjAKksNg/0vZGN2PHllwYtHX5bnJWo872qRLwBANNlDcq4C4Kd6eBisPqrmRRlRV0l X0mT9y3rar8sYzANifcRVIxSSqpDG6Eflz2/5XZzwHw0AQcEArVaGn2V+1M5JFGRyif3 chNTYoId7GwT2Ac0cYidlTFhvrTbjrvmuLRcBwoiSnDs558dpivdysZd4AxciFQIt95M JbjQ== X-Forwarded-Encrypted: i=1; AJvYcCXM/Hk55frQIDl75vQ2/Df5qqzDL0ZDetswigHlxt4mLWqakbShhqqn+FEq8gSOxHSwvThaCD7BFxKrC3IBVi3Z3nM= X-Gm-Message-State: AOJu0Yz+2wOZIJQNXH3rNg2kTPAFTW0x5/JD5JkpuThgvQEFmfZeEZ52 4S5wQn8kA4VKkuBK3bVge6j+YqIWy0uJE4z+uO24n/Y86kubsKsvektsPxhQ4KM= X-Google-Smtp-Source: AGHT+IHO2SpqxV7EEds5UnseQz6m895b8lvndStl3JKPg+YCA3YJ6jhNvZizr3ciEEIKub3G06vDkQ== X-Received: by 2002:a17:906:6949:b0:a3e:9ddf:9f68 with SMTP id c9-20020a170906694900b00a3e9ddf9f68mr5159042ejs.43.1708496537367; Tue, 20 Feb 2024 22:22:17 -0800 (PST) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm3404027ejc.142.2024.02.20.22.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 22:22:17 -0800 (PST) Date: Wed, 21 Feb 2024 09:22:13 +0300 From: Dan Carpenter To: "Matthew Wilcox (Oracle)" Cc: Andrew Morton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, kernel-janitors@vger.kernel.org Subject: [PATCH] mm: use ERR_CAST() as a cleanup Message-ID: <5a64b69a-40a6-4add-b758-ec3a9d93eb11@moroto.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Stat-Signature: 3n365f31jc4knxjm8kyso3gjbd7zxutj X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: E617380010 X-Rspam-User: X-HE-Tag: 1708496538-133469 X-HE-Meta: U2FsdGVkX19CuFQ/lgaLMJ17hoykpJA5y3bvqnmCYlc57XmCQgKPeq0wZHtg6Pbj/NOPu/4ft4de8k3IzBapvgHFKta/EKcC1TEHp3NC5hbIhWPs1I5UQyWFqeq5Uf1iQK4IuQUIV4V3GIoIFXdorbwzci9dp+oS3UN9F+uhWD1aILal5dSdtcjl/Xq9n+vdN4iX/HM1pBgo0QElvP+B3NgUN5u5pEhi88XOReXtQYJpQdtu+qMSmOt81rNyZx3gGLACtB/a8zsa6vQVyx1wtl3R3a9oRStXkOYbC7hc6LMapAQifeMaPenASM3DKF6gGLhTZmWfN0CMKAJYfFPpMpgqY1hysRoaL2BmLW40VB/ivMcCEDSI7s9K3Yequmxxp8oVBwdoIXlvrBwvCNimr4FdCGPtprw+jBZL/xL04QOber1lSHjh3oKvJuGRipPUhgz2Psf6QiBbOVAyw8scNNiN1dhW1s1y7LoGPY8SG7T6QKdAjr0qGQl2KQeTDriXXc4l3C4FCB4R5CU4FW45CGKW4yvGD2sbKo8Prfm5t3wksPmb2P1168m55b2NrCZwUoJqjqpwwRn25luOc0GMTKazMfM0yb16MjdB3Uf74PNeQX+FuLSStJ5YfeDVx8TGN91iZizNj9PbClGwgOWdsC0qXqoS91UKcfqZif7l9HGdXyMwr2HOBP2MzA6lgRg+E9yBceXT4K7VNd4bDk/ICX8zhdpQmHJ1rq6itCmMGw/ID9iRJYIseT2UfJyb6wguIQjJRzuEOmeOjQ1XCa58C2xCEiKDO+FrvhHNdqPTffEt9JQrba1iwaLjmJC2ScFNV8AVSolq/seiQvP1Q+RxoCqn7IT9daP3gW2D4PBApXK9pSwjpdKLpKKuPTLqMyLpG/TgqtutqpoCu+jdvNimsNcBwZGTXkPzwKBR5EONIkTbs3Xf4HpJB3btFWa8qIFdCZL1HX/olRPY2eRYbFE WTLUMMH5 2ms0orf6M0COpoDhqLUWL0WbjuYUbm4jwEdMM6vNNpBGN4z2O8xoSrBy3hIXX7GpW4plsKywKjwKQ97KgrobRPg2fa+yGS9AUqDRyZtWMUTtCvrY0xuv7yFdJWw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The ->page is the first and only member of the folio struct so this code works fine. However, if we use ERR_CAST() then it's clearer that this is an error pointer. Signed-off-by: Dan Carpenter --- This was introduced in 2020 in 539a3322f208 ("filemap: Add read_cache_folio and read_mapping_folio"). mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index 5603ced05fb7..54e9ebaf4e84 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3768,7 +3768,7 @@ static struct page *do_read_cache_page(struct address_space *mapping, folio = do_read_cache_folio(mapping, index, filler, file, gfp); if (IS_ERR(folio)) - return &folio->page; + return ERR_CAST(folio); return folio_file_page(folio, index); }