From patchwork Thu May 13 05:09:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 12255163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B7F9C433B4 for ; Thu, 13 May 2021 05:07:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74F6361263 for ; Thu, 13 May 2021 05:07:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231153AbhEMFIU (ORCPT ); Thu, 13 May 2021 01:08:20 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2650 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230306AbhEMFIT (ORCPT ); Thu, 13 May 2021 01:08:19 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Fgfh05KQ2zQmjK; Thu, 13 May 2021 13:03:44 +0800 (CST) Received: from huawei.com (10.175.103.91) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Thu, 13 May 2021 13:07:02 +0800 From: Yang Yingliang To: , CC: , Subject: [PATCH -next] vfio: platform: reset: add missing iounmap() on error in vfio_platform_amdxgbe_reset() Date: Thu, 13 May 2021 13:09:24 +0800 Message-ID: <20210513050924.627625-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add the missing iounmap() before return from vfio_platform_amdxgbe_reset() in the error handling case. Fixes: 0990822c9866 ("VFIO: platform: reset: AMD xgbe reset module") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang --- drivers/vfio/platform/reset/vfio_platform_amdxgbe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/platform/reset/vfio_platform_amdxgbe.c b/drivers/vfio/platform/reset/vfio_platform_amdxgbe.c index abdca900802d..c6d823a27bd6 100644 --- a/drivers/vfio/platform/reset/vfio_platform_amdxgbe.c +++ b/drivers/vfio/platform/reset/vfio_platform_amdxgbe.c @@ -61,8 +61,10 @@ static int vfio_platform_amdxgbe_reset(struct vfio_platform_device *vdev) if (!xpcs_regs->ioaddr) { xpcs_regs->ioaddr = ioremap(xpcs_regs->addr, xpcs_regs->size); - if (!xpcs_regs->ioaddr) + if (!xpcs_regs->ioaddr) { + iounmap(xgmac_regs->ioaddr); return -ENOMEM; + } } /* reset the PHY through MDIO*/