Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp762195pxa; Sat, 1 Aug 2020 05:25:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztjvyK7o/g7ltVWOGV711DIrow3eEyyK8nIBS8XmUeEQPfDNQd+96iCV57aQwFpYk3Ha97 X-Received: by 2002:aa7:d145:: with SMTP id r5mr7812102edo.323.1596284745755; Sat, 01 Aug 2020 05:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596284745; cv=none; d=google.com; s=arc-20160816; b=RZbHFcYIQT4MwgB7yaVZtUq3t2bYVtlAjzxpwbVxI35/xGzta7gg80aCr/M02UTucF vkrGq8D3K/3Ed0sAtpts5La169pYvo8FUrJiXMLXnfdN3WTHtij/C1TMFPcHgDFzZ1X6 YC9DbS9L861VaXZcaPEK061+9YdiNBA1vz28CVAZ+As1i0r+ztRf1MH2RHcoIzh5B8l2 Xrseojg0GpobYGJ85aav+vqhVOcMAuM/mfkGwUoJOsd3OyPMquX4zDGcJPsHRWTbv8mx 3nULauW4WOfKj7g/1sq9cmP4DeXeprD/ElipP/C351VS7BROYmBhTih5vzbzvKCVw+cl Inrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=y/Cb7GKK5mO5miGjoqukiO9DrcaVbTzBZ/XAaAsprek=; b=UuwDkLT1zXo5AaNaxtHnW07jrDXVGYOmyCs7YPnE5h5h0o91GZp7WQpMmnf//DB1OX 6cY74l2IVEZdWcNRlAV9MdxYL0DcH9zbd4lJ+leGWsOznxByL/yhNRVc97P4kwaX3aGp lH8NvHtrREw0vG05zWv+vx4ZXQNQwD3Uoo4RnocvvbfIgXL2XIvYhs/s5T/Q5KyVHbIe W5Jc1RHVVgJpCyGM/+XMdXWk9Kbz+nU3SdAB2naGJmF9AEWrntakfhox4aKk4dRQxG0n 5rYAnuise26IPhO3hlwhmGQO/6ki7ZdULNoCeSLnrGv1O/FbX/+pFUwRW4/8OOi/uJ+B 4+RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hgKqoCrs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h23si6727532ejj.573.2020.08.01.05.25.23; Sat, 01 Aug 2020 05:25:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hgKqoCrs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729161AbgHAMYv (ORCPT + 99 others); Sat, 1 Aug 2020 08:24:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729110AbgHAMYr (ORCPT ); Sat, 1 Aug 2020 08:24:47 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A9EFC06174A; Sat, 1 Aug 2020 05:24:47 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id o10so14440173edh.6; Sat, 01 Aug 2020 05:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y/Cb7GKK5mO5miGjoqukiO9DrcaVbTzBZ/XAaAsprek=; b=hgKqoCrsgEvqzZxuemcdmAGc7l+erLtC0MIMuinBU6Z7xRXXMH08QxW5iaYUUehX4a N2jhjFbh6KSNqPO6rdIXcBDOVF+TC3NA3OpVybZTUL2FZnmU5fe1xan0Ku0OsTsKgJBT 2Bl+4Fm9qSzXFiD2qF5WRx67/ES4EZypV3beloZaZm672olY421KHi08EwsFRo3ualou ugM9j06fc7F2D6U3a6xTJCuLmhn+UiqI0N3tIwyBhgTUcLrRz0fNiyAjWlAKP6mHkIdm eTJXEvhx4KUsgrDhJUp31wqdm0zs7H8VlSv9shvME6ij/bBn32Wm2j3Nlw+fMdhGApwy SPMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y/Cb7GKK5mO5miGjoqukiO9DrcaVbTzBZ/XAaAsprek=; b=YbJLGTo6YxT6L8bmdIauPy8HPPIuCImmPNMesgZ7TRwExace8oX/uQ0/WIua2FfWyy HmygaErDT1JrcKrflGFUgYeap9EtYT0rPKUEHiOURRZYT0zgqnLcsZAB6oU4Y4IXNAjA RXj9J139nNLxQpYQXxHeb1ejFGzWFyqHlRPGDStbsqgQbL9lGCeAF3DCqwpJ5yUA3k8I Uhaw6EcInVQy5ZbQWKYaov+xk5LEsQWkqjwPHpHmSTwmTOsN+R+yBM60nL696h7W2lwG TmcB/cwD9QuouqCu7kA2XFmz0aCJ0GYw5BPyjYDjKocACzGSfhC27vwAzEghJIPxF5+z Skog== X-Gm-Message-State: AOAM530hhXu0epEh8X7/SgBGv8BwNslPvQPAERp5mXRnr7yStj0J872A r91U9PPIySUZ5/k7svlZ6CU= X-Received: by 2002:a05:6402:13c4:: with SMTP id a4mr8165000edx.108.1596284686131; Sat, 01 Aug 2020 05:24:46 -0700 (PDT) Received: from net.saheed (95C84E0A.dsl.pool.telekom.hu. [149.200.78.10]) by smtp.gmail.com with ESMTPSA id a101sm12083131edf.76.2020.08.01.05.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Aug 2020 05:24:45 -0700 (PDT) From: "Saheed O. Bolarinwa" To: helgaas@kernel.org, Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: "Saheed O. Bolarinwa" , bjorn@helgaas.com, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [RFC PATCH 16/17] mtd: Drop uses of pci_read_config_*() return value Date: Sat, 1 Aug 2020 13:24:45 +0200 Message-Id: <20200801112446.149549-17-refactormyself@gmail.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20200801112446.149549-1-refactormyself@gmail.com> References: <20200801112446.149549-1-refactormyself@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The return value of pci_read_config_*() may not indicate a device error. However, the value read by these functions is more likely to indicate this kind of error. This presents two overlapping ways of reporting errors and complicates error checking. It is possible to move to one single way of checking for error if the dependency on the return value of these functions is removed, then it can later be made to return void. Remove all uses of the return value of pci_read_config_*(). Check the actual value read for ~0. In this case, ~0 is an invalid value thus it indicates some kind of error. Suggested-by: Bjorn Helgaas Signed-off-by: Saheed O. Bolarinwa --- drivers/mtd/maps/ichxrom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c index fda72c5fd8f9..04728d902e49 100644 --- a/drivers/mtd/maps/ichxrom.c +++ b/drivers/mtd/maps/ichxrom.c @@ -61,8 +61,8 @@ static void ichxrom_cleanup(struct ichxrom_window *window) int ret; /* Disable writes through the rom window */ - ret = pci_read_config_word(window->pdev, BIOS_CNTL, &word); - if (!ret) + pci_read_config_word(window->pdev, BIOS_CNTL, &word); + if (word != (u16)~0) pci_write_config_word(window->pdev, BIOS_CNTL, word & ~1); pci_dev_put(window->pdev); -- 2.18.4