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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A20D8C433F5 for ; Mon, 15 Nov 2021 18:51:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B6EF63626 for ; Mon, 15 Nov 2021 18:51:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239759AbhKOSym (ORCPT ); Mon, 15 Nov 2021 13:54:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:45794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238183AbhKORfL (ORCPT ); Mon, 15 Nov 2021 12:35:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 812A7632C5; Mon, 15 Nov 2021 17:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1636997005; bh=mawGj9bAkOCUY1SQvO7k329OHtMuiLJXsMOHqPd/XFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ydlm3hBVeAKrT5fGUfkPsX+nga0kwA+ld2PH75wPoIx0TyxlAN9l3nWWoIzJbWGB/ z8PnE5zZ28rGhKI6CWcNtULTZZC4JABR1d5DaC2E2bWODHarhM7tSr0XSqHOpBhRZm NsYf/RLP0b5RReu5h1fq6kX2Ri+3HkTgT8tb4plQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Juergen Gross , Boris Ostrovsky , Sasha Levin Subject: [PATCH 5.4 315/355] xen-pciback: Fix return in pm_ctrl_init() Date: Mon, 15 Nov 2021 18:03:59 +0100 Message-Id: <20211115165323.907176424@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211115165313.549179499@linuxfoundation.org> References: <20211115165313.549179499@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: YueHaibing [ Upstream commit 4745ea2628bb43a7ec34b71763b5a56407b33990 ] Return NULL instead of passing to ERR_PTR while err is zero, this fix smatch warnings: drivers/xen/xen-pciback/conf_space_capability.c:163 pm_ctrl_init() warn: passing zero to 'ERR_PTR' Fixes: a92336a1176b ("xen/pciback: Drop two backends, squash and cleanup some code.") Signed-off-by: YueHaibing Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20211008074417.8260-1-yuehaibing@huawei.com Signed-off-by: Boris Ostrovsky Signed-off-by: Sasha Levin --- drivers/xen/xen-pciback/conf_space_capability.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/xen-pciback/conf_space_capability.c b/drivers/xen/xen-pciback/conf_space_capability.c index e5694133ebe57..42f0f64fcba47 100644 --- a/drivers/xen/xen-pciback/conf_space_capability.c +++ b/drivers/xen/xen-pciback/conf_space_capability.c @@ -160,7 +160,7 @@ static void *pm_ctrl_init(struct pci_dev *dev, int offset) } out: - return ERR_PTR(err); + return err ? ERR_PTR(err) : NULL; } static const struct config_field caplist_pm[] = { -- 2.33.0