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 DB64DC433F5 for ; Wed, 24 Nov 2021 12:24:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243731AbhKXM1J (ORCPT ); Wed, 24 Nov 2021 07:27:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:36482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244119AbhKXMWx (ORCPT ); Wed, 24 Nov 2021 07:22:53 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 74BAD61214; Wed, 24 Nov 2021 12:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637756027; bh=SIGqIObj6Izhd7JpPtGhNQ5aCiNx3L7VJLUbad9fhPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ow4G34GbozR9/pG08WXyZGbp16RUBrDL1WzddHG2g6J840rA018P9jsC/SM6h3sWv FrzOhgS3VNax8kcYEyyhjw+kRjB0rWY2po68vZz5gkMT6dxW6uovfWpaTAlhxUpEJI 71IXRy5fUeHGNjdWUhkakilv9tnCEGLwu5TGl12g= 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.9 144/207] xen-pciback: Fix return in pm_ctrl_init() Date: Wed, 24 Nov 2021 12:56:55 +0100 Message-Id: <20211124115708.678171135@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115703.941380739@linuxfoundation.org> References: <20211124115703.941380739@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 b1a1d7de0894e..daa2e89a50fa3 100644 --- a/drivers/xen/xen-pciback/conf_space_capability.c +++ b/drivers/xen/xen-pciback/conf_space_capability.c @@ -159,7 +159,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