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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F255FC433EF for ; Wed, 24 Nov 2021 13:08:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347520AbhKXNLr (ORCPT ); Wed, 24 Nov 2021 08:11:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:52020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348357AbhKXNJL (ORCPT ); Wed, 24 Nov 2021 08:09:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B98906124B; Wed, 24 Nov 2021 12:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637757619; bh=mawGj9bAkOCUY1SQvO7k329OHtMuiLJXsMOHqPd/XFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqFJV2iMeEQLUFKctgQ5edFXae88ReGIeKZuzmqozdec8eTWrJK03TknFAIA5s7Oh Kq+fRUYoucz8O2uZTr3zvJvAfqmysYABi75JquEVS8G0fSrX8ik3+tp/8yL33uwj1z 4dpvMfmq9s2N1DskT41yVhqmSEQnPGvjNe5tmfOM= 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 4.19 220/323] xen-pciback: Fix return in pm_ctrl_init() Date: Wed, 24 Nov 2021 12:56:50 +0100 Message-Id: <20211124115726.358639210@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115718.822024889@linuxfoundation.org> References: <20211124115718.822024889@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