From patchwork Thu Oct 7 19:13:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 515470 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp1465248ime; Thu, 7 Oct 2021 12:13:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjilAwzTrVkL2L5ewJHwyr674iYcNU4Cz0eWXBwJrD8RrboeDq2u0dFgVAn5/WmkwtQ5gZ X-Received: by 2002:a17:902:b945:b0:13d:c17d:4209 with SMTP id h5-20020a170902b94500b0013dc17d4209mr5659157pls.75.1633634027089; Thu, 07 Oct 2021 12:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633634027; cv=none; d=google.com; s=arc-20160816; b=Mojf23OoJFsZg4/Au6caHAgzZW2ZOB0qVuXVh9yxyWwZ8mdV5aKYcjP8yqB0OZU6Eq ZUlaOBNpyujlzmIXo64DwHu7nlm9UWWhLZ0jRQ9e97hMtHlOsdub8MLPHIOSW8I7ubLY M65mkoEawUfRhd/1gxtDAOLxqq9jAejRYSdpP8a1gb3QekIpnj8ZKiQ1PcJRyvT7uTVO CTEWMZfT5JVfUB25H3EEg7bK3GQ9gTI5DuaNNVz/owUnnEgi3RDeaC3QdDcFwOkU6xj2 gQqcuLIff0mI+NQrxVE6O9lmbZsvoQ0yc3QhM8uE1aXXsHiX0VbakAVQGL6QG8OAn2dD 2avg== 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=cjDe0yIphZCEaHpy1akQDBeuu+tsHx+ZeFrUoh9wGPM=; b=s5GL6shS8OEVGxnifCTN6nj9YXQwz6NOx7FD/8hfMEBI0ywLwuWIMOcRT++PzqveWA HQQZjfp3VPIkMX4f9AE2R/nN2YSyl0LboWbf/zkOVSharJW9jahWbfG12bwnBPiTImOY z+YcX5TZoyCvT5V9enCJxfdStBRabR4ijsgUD/L9JODWZNmtFkHyxNEbRa9knBvkWEiB nasWJFMZRrdAYDaBoxWIawheL/0W0hOjV7T59IJTA0lDAjFNSXzPlMHALnin0Ib4qIsC /XmQhj0g/USC7qs/L0ZmesnUdN4nz6z3Aqd3HvtihSkUW3DOyEk2tbeIDxx9ufDoMQXV poMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jgrcGzrj; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n186si33115862pfn.151.2021.10.07.12.13.46; Thu, 07 Oct 2021 12:13:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-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=@linaro.org header.s=google header.b=jgrcGzrj; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243875AbhJGTPj (ORCPT + 7 others); Thu, 7 Oct 2021 15:15:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243890AbhJGTPj (ORCPT ); Thu, 7 Oct 2021 15:15:39 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FC98C061755 for ; Thu, 7 Oct 2021 12:13:45 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id j21so11199231lfe.0 for ; Thu, 07 Oct 2021 12:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cjDe0yIphZCEaHpy1akQDBeuu+tsHx+ZeFrUoh9wGPM=; b=jgrcGzrjOxMDM93NIaXnv2tlQHrXOQHWIyxyZHpPdUpdOzemNbpBZhMsFaYppOX3GO 0vyUYYwwXjXPLxtSHi21GDI11YGPcx60ph5sCXQ6Vf52w1UdoLqv9kVlbShoYFU2DpNn IahKp6bS8ouGV8PHoL0SYFBjvd2VuMTfyTyF+B/gBYUflP6//SbgOBW+NPUjHFGv2aLF oLlU9/3sBODrBzuYpuCHVFv0PVZvGYFbXVo++04FSgQymfOCRgmrG2oYslptjIzyMDDB T01TE9M9r9TsVWR5Q9Nl8eNufYWAecst8G5Y+fwTC0jQVhBQKKogp+XLHUEE+2R4O9Fe nXzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cjDe0yIphZCEaHpy1akQDBeuu+tsHx+ZeFrUoh9wGPM=; b=yz4gDE/jL7GzwsMewDZ2O5SKB+rdIkkI3hjFVV/fWcMfowWg9ASnrBNvkGiJVYIBur NSpBzIZyxN9NGyFzYt/dhD5MLNMcz2fwD/GjZVAc11V2j5YhpvstwUQJyghSa3Yss04S kWTEWqm0ZScHu3O0GNNK5behDpJJPYJMqUhmcHl/ggE2K97qQmzn4Q+N0kWdwkTYKWWj hloldYtCIFBRkwRGlnkZRnLwHrNv6mTrQXA9POFMzdzIT0WBYm063jGu7HZA2QorvoZA 8zM2mNGNX/TyqpoSNbRKX5MQJAw4A1CDm7+enFrbIeoLkQDQiDYj5aGgKXOmZfYXStfk YY2Q== X-Gm-Message-State: AOAM530wVS8CMm8w0JeB9fWKnzJZwMXV4XuSDB9pMsnAjeLax50ll2H9 agpyofHdpdmh2L27PJhTvelRKQ== X-Received: by 2002:a19:5e56:: with SMTP id z22mr5822395lfi.146.1633634023417; Thu, 07 Oct 2021 12:13:43 -0700 (PDT) Received: from localhost (c-9b28e555.07-21-73746f28.bbcust.telenor.se. [85.229.40.155]) by smtp.gmail.com with ESMTPSA id b12sm16677lfe.253.2021.10.07.12.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 12:13:43 -0700 (PDT) From: Anders Roxell To: rafael@kernel.org, len.brown@intel.com, pavel@ucw.cz Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Anders Roxell Subject: [PATCH] kernel: power: swap: fix sparse warnings Date: Thu, 7 Oct 2021 21:13:37 +0200 Message-Id: <20211007191337.540058-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org When building the kernel with sparse enabled 'C=1' the following warnings shows up: kernel/power/swap.c:390:29: warning: incorrect type in assignment (different base types) kernel/power/swap.c:390:29: expected int ret kernel/power/swap.c:390:29: got restricted blk_status_t This is due to function hib_wait_io() returns a 'blk_status_t' which is a bitwise u8. Commit 5416da01ff6e ("PM: hibernate: Remove blk_status_to_errno in hib_wait_io") seemed to have mixed up the return type. However, the 4e4cbee93d56 ("block: switch bios to blk_status_t") actually broke the behaviour by returning the wrong type. Rework so function hib_wait_io() returns a 'int' instead of 'blk_status_t' and make sure to call function blk_status_to_errno(hb->error)' when returning from function hib_wait_io() a int gets returned. Fixes: 4e4cbee93d56 ("block: switch bios to blk_status_t") Fixes: 5416da01ff6e ("PM: hibernate: Remove blk_status_to_errno in hib_wait_io") Signed-off-by: Anders Roxell --- kernel/power/swap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.33.0 diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 9ec418955556..47107f9cd14c 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c @@ -299,14 +299,14 @@ static int hib_submit_io(int op, int op_flags, pgoff_t page_off, void *addr, return error; } -static blk_status_t hib_wait_io(struct hib_bio_batch *hb) +static int hib_wait_io(struct hib_bio_batch *hb) { /* * We are relying on the behavior of blk_plug that a thread with * a plug will flush the plug list before sleeping. */ wait_event(hb->wait, atomic_read(&hb->count) == 0); - return hb->error; + return blk_status_to_errno(hb->error); } /*