Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp493304pxb; Thu, 21 Oct 2021 03:50:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfOPvC/jcyHJ8jjmKuCMdMQ1LJBQxC7f3wenPuVNl5oOjJnUT9lpeq71GJn2ikH/DnMM0A X-Received: by 2002:a63:36ca:: with SMTP id d193mr3775559pga.73.1634813429325; Thu, 21 Oct 2021 03:50:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634813429; cv=none; d=google.com; s=arc-20160816; b=nDfGyD6Ti1q+Jy/mfAqJJct7EGqUBR/ow1wae7Wp1L/YfoJ3htM5JoTAZKF5lWVprV BGN0Pwfp0u/y7RVpyShfwp0ZBEbzqKCJY+cjli5mSwkFnDYKGWzvD/mWKvaC+rD04/0M QvCHyUE5TP3IY9wWetIZk+pz6YrmbHvuqwZnnfWbRd2mpZceTzidqBG+9eDUSJInYu7K iRQqj7Q9fU9y43MnOXJqQRARfEkepU+bFwrSWzmvdyc5nYaIaFYmsQpxlXElZj9ZIU8w TLzGZlrbE6Wqo6h53qbmFamEWPj/S3h7RPUNw540DTsZEJgZzp2tq08nEQMHGIsF3yLD cKmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=nP2vFNPxI37N8uLOpzFpF7dKWuNYgW2/FE/Tat39R0Q=; b=sKUlZc1FG1tW7GsnKLgFhVly1t4pwSrSLKQaeAw7pa7SFRqQcT9/9pA6iATefCRjX/ B37o0FiXj5FWACzjcFTKTjDLeZlX4YhUxQYs2g7IVtmBkPSXPMQTOU3JvxvBUn/0s/TS hwFJp6ACqdIjpeHjL8zXrSDoLi4AgZ2O+CEFEmRZIUAqu9xnm9fNxnht6H2XZvK2/pII uRXEoAnEDWbcOTp5026H6xeO7apb9hbxfHy7LXsAbXQgWLWhYhF5shMf9chb0xeFxrME mBuegvZPPURSqmgy3RUnezDa10Gz3XXjXitLz4t4kUQ5p/9S3Y23q/xjXr7QlX9j4OvM YhnQ== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si6619925pgu.379.2021.10.21.03.50.16; Thu, 21 Oct 2021 03:50:29 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbhJUKvf (ORCPT + 99 others); Thu, 21 Oct 2021 06:51:35 -0400 Received: from mail-oi1-f171.google.com ([209.85.167.171]:34530 "EHLO mail-oi1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbhJUKve (ORCPT ); Thu, 21 Oct 2021 06:51:34 -0400 Received: by mail-oi1-f171.google.com with SMTP id v77so366548oie.1; Thu, 21 Oct 2021 03:49:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nP2vFNPxI37N8uLOpzFpF7dKWuNYgW2/FE/Tat39R0Q=; b=QpPzAI9kHcato9eV8oye5+iRrSm6Ji0ZQJT0CZarhNgBJR8qVBkgndyJhLroLdo1Dp 9QbX12YuTwu12BuHJA1zy3k5SK+kvum6kzJlcxlYtgX13HaPn2/0no86GnpHzr24jNQx LbeBB+HwTomfPH2z+S/OiH+/Rv2BMZ7Wq/FVIaFCh873swrcmzxB7+uisSw/6r1D+uYT kisXtoNbKGxoP3QMC4j4+8bX+Jay5KF9URNdoYRZ2+Ko+GI33JorKhM22V/sXKXiT2AX ycozBg6UdgrkQBHkAmdxfaovG+JbFA0foc3LuyXIKqI9nou8Y8b1JdwlQpOJe6O63D+7 DsiQ== X-Gm-Message-State: AOAM532szNTnewlRYpxSC/3TdK2y25CI2KC0c48if+4VJWBj68JWKgha 1f6Kaspn07bT6Y6L5hGH5tInvR1IqHdwtuYvRYwaTOel X-Received: by 2002:aca:5c5:: with SMTP id 188mr3673122oif.154.1634813358761; Thu, 21 Oct 2021 03:49:18 -0700 (PDT) MIME-Version: 1.0 References: <20211007191337.540058-1-anders.roxell@linaro.org> In-Reply-To: <20211007191337.540058-1-anders.roxell@linaro.org> From: "Rafael J. Wysocki" Date: Thu, 21 Oct 2021 12:49:07 +0200 Message-ID: Subject: Re: [PATCH] kernel: power: swap: fix sparse warnings To: Anders Roxell Cc: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Linux PM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 7, 2021 at 9:13 PM Anders Roxell wrote: > > 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); > } > > /* > -- Applied as 5.16 material, thanks!