Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1659409pxb; Thu, 7 Oct 2021 12:15:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzw42iq/zYsjG3iQu0B9xunSVgAZWp4PY6+mCyyNxXo3EHdrY2qNtdSbPfA0SuE/bSnRzPl X-Received: by 2002:a05:6a00:26e9:b0:44c:654f:80e9 with SMTP id p41-20020a056a0026e900b0044c654f80e9mr6214321pfw.14.1633634132820; Thu, 07 Oct 2021 12:15:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633634132; cv=none; d=google.com; s=arc-20160816; b=zmRnOuoo0g3HXXr2ftys/SV6hJ53zdRi5x0di8w3OKUXVgBr+k44eKRu6ZHLE9u2bD blrgVnKlc11w/fjuBjiXbnYgSGkKt7SwKIBK7GHJcVYmivflb6nhD62Sz3VMOv5UnEd4 1Yh2Hk+lh2Ty1mpIB3qzosWKDJrTLQqvaUawHoaXM+8El1U/+DBgq3A5kKpJcgJPAtNZ PZm5XF/F2h0wS78Z/7iYegWRdyniqUxHU3NrE8liWoktbI3iFuw6G1Z9VF0LCL0/+0m+ vJkeQXr7UE4SKmm2AMUkw3apZ2BuAkVc8mb404CBR+ayD6UCsitAdPl8cndopgB3oLZq 1gjA== 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=ShMRy9Pmw1Zmtpf8yrE2V29El5UkI4qgsjHwVRRR7iYVJf/NHqXyOhKATlRtJi9/+K Vl4nLj9akp3pAZEv9e0KRmIhHTX6hny31S0A8PRMby9ju473J+D5cbFnPJyb9VMrSrxS RIqvYVghaAezvpCNzQVgMbcyvQbVbRf2aCj0IHfdGZf0GcAuMuCBK7/WgqeRdSuxrmBw 3ts4Cms713k1N7VFaVyWxhHVAjBEcNrCQiXQnOsJY31qjK48cLlx+ydqZbl/Or1iUp9a y1dxG3xMTjewqnIK588xOFcl2Iy7nQJpk+Bx5lNdy9jVuOKgHXISISWCfavU/Pl5Zl/K 4ASg== 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-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=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 g7si250302plt.123.2021.10.07.12.15.19; Thu, 07 Oct 2021 12:15:32 -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=@linaro.org header.s=google header.b=jgrcGzrj; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243890AbhJGTPk (ORCPT + 99 others); Thu, 7 Oct 2021 15:15:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243882AbhJGTPj (ORCPT ); Thu, 7 Oct 2021 15:15:39 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F4EDC061570 for ; Thu, 7 Oct 2021 12:13:45 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id m3so29291459lfu.2 for ; Thu, 07 Oct 2021 12:13:44 -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=qbPpDja8deOUEcOuwLO+jDAJDa/tu7wJ+3657tRX3Biu0jiJXvrBr9XrTtUdhUna0U yYPCzIoW3jpSTm+izYkIqkjXjpb8a3/tTPs7RGJhZnducjdO/z1IoNMWIvgcV04yq7Hs AW8+LDQ7ig7v9+azSR8sHuEH7IyHcm3PizFTQKBS//A8BtkbNPs1J7TFeaYV8GPyplFh bwPfzQAi8jMNeg9ciB/XO2SMkCuziW4VjsNMIWYx1TBMdBrv6JTbFd6RhhWPI7npYdso nqXMD0ExS3UxPCqAyHxdWwDcmAr5FCjhJWs0F9v8PS7/XLIZScRfg9RNgOQqcHw4uWRS 11xw== X-Gm-Message-State: AOAM5317G3NvrzODIdiGrT1/dEXpWRnMBKGX0vy/U12lmqDhMm94ULQD k3D2mMdEp1kprahQcWRX28OD+A== 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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); } /* -- 2.33.0