From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 4745CC432C0 for ; Fri, 22 Nov 2019 10:33:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CC1320714 for ; Fri, 22 Nov 2019 10:33:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574418808; bh=K08qYBsV8gIGodec1gOeRpkimbF/syiDZ9dHNTWL40Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HbtWCbGIupnWqtj5ICjXrXeQFZ9UUbVlUW4FQrmwhZl7R06L0EIHPx3JM7C1y89iL sDeTyGZpm27ZA7AbSaI5Adi0WJpNbHcEKcxrfoTjihPwW9FGiA1fGoGdca7K/qU13T EAISRSD6NBpFxIgj+iCRoEamPx08wyiz6rtSjEa8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727105AbfKVKd0 (ORCPT ); Fri, 22 Nov 2019 05:33:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:55996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727930AbfKVKdW (ORCPT ); Fri, 22 Nov 2019 05:33:22 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 361EE20715; Fri, 22 Nov 2019 10:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574418801; bh=K08qYBsV8gIGodec1gOeRpkimbF/syiDZ9dHNTWL40Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sTVp5530mJTT3sejqc1iqNmr8i9LK59iYdSGpCEtEjlbODTJzbp2YLlOv9g5E8cgQ qBN8XsLRAEqhoNNJ7b4Q0MP1D4wc8Obt5+5FaqqxnOG8d06MtLQ2rB2PWj+7tXJyST CpvlUjMfPNBK4RzDRDPpRU4QZHy0563QKCx0rWxY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ding Xiang , Atsushi Nemoto , Paul Burton , ralf@linux-mips.org, jhogan@kernel.org, linux-mips@linux-mips.org, Sasha Levin Subject: [PATCH 4.4 029/159] mips: txx9: fix iounmap related issue Date: Fri, 22 Nov 2019 11:27:00 +0100 Message-Id: <20191122100726.203902702@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100704.194776704@linuxfoundation.org> References: <20191122100704.194776704@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ding Xiang [ Upstream commit c6e1241a82e6e74d1ae5cc34581dab2ffd6022d0 ] if device_register return error, iounmap should be called, also iounmap need to call before put_device. Signed-off-by: Ding Xiang Reviewed-by: Atsushi Nemoto Signed-off-by: Paul Burton Patchwork: https://patchwork.linux-mips.org/patch/20476/ Cc: ralf@linux-mips.org Cc: jhogan@kernel.org Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Sasha Levin --- arch/mips/txx9/generic/setup.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index 9d9962ab7d25c..7dc97e944d5aa 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c @@ -961,12 +961,11 @@ void __init txx9_sramc_init(struct resource *r) goto exit_put; err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr); if (err) { - device_unregister(&dev->dev); iounmap(dev->base); - kfree(dev); + device_unregister(&dev->dev); } return; exit_put: + iounmap(dev->base); put_device(&dev->dev); - return; } -- 2.20.1