Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp63958imm; Wed, 5 Sep 2018 21:21:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ9SoHe0tXR2g7l2eDDECZKeTko8HgFnYw5yShpPzmxswrJ8eXQaTBmCNcTpxDY65wIxnQc X-Received: by 2002:a63:e54b:: with SMTP id z11-v6mr900831pgj.328.1536207668134; Wed, 05 Sep 2018 21:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536207668; cv=none; d=google.com; s=arc-20160816; b=EZckBErBhT6nc/XQ7Mh1r1HENaTVtyT8MIOsXuHcXrTxMp6dZA+q1Rcs6/qfmJkGoc ddX5dUO+YnPzn5rTe5imySmoxomo8LAfgr1TZZtkTErjY9UyvltcHF5pjBoqkpsSjbwQ FTBzT3IIE38QbQV1hyaDfQoQXDPX4gtilFe+UKYyCV6CLrvnvwXE6da9/zOB9pnz8AZ1 7ivdxVLEjRAECsmBB+pkt/vqAt6wVUI25H21eOXjD+KwAGXyX9ab0zgDL+O+RRZSQEUf MsSk/RIw8JUHGWTXwh1qF0UVPTc1PZncfcvTnsV2Z9fN4G2s9zhiHIMSQtqmoFlTK5st T14A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Vm5uPwU7i2BDmfOj/v910EfoH8JkSyKS1auqrEtwdd4=; b=yzy6sEreoA7/llltKiYrUvbnqsQE6E2IA+y/hNVe1X3VO1dP2lo6rGqLuKVZGSk3qm S86HKRHxoWIQoSZ1NjyINvFLWKkH2sE+99nWrxKRgmP3nrPaYRBUoEliftmVHJo8d0zo xEaWwdz55TBvsgkijVhfFE2kKCwLafSMYo0DkPyefXC4UmhCvOgZFXyaX+tKlKr3WXRU YBVhWALz58+Dxzjr3+AI/qiA/MvpVmVSNE4hNV0K+LalMBHbHqYyIeoMh6WEqCD03iK+ HFEnl+Lz+deuDu/mdiY41C2Abn+Gv3LWUeZ20jioNM3C1UYrONZ79BHzoBpoke2cpQqw S4lg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1-v6si4255342pli.469.2018.09.05.21.20.49; Wed, 05 Sep 2018 21:21:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726086AbeIFIwz (ORCPT + 99 others); Thu, 6 Sep 2018 04:52:55 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:45976 "EHLO cmccmta1.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbeIFIwz (ORCPT ); Thu, 6 Sep 2018 04:52:55 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.17]) by rmmx-syy-dmz-app04-12004 (RichMail) with SMTP id 2ee45b90aacb152-fd433; Thu, 06 Sep 2018 12:19:23 +0800 (CST) X-RM-TRANSID: 2ee45b90aacb152-fd433 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.105.0.243]) by rmsmtp-syy-appsvr09-12009 (RichMail) with SMTP id 2ee95b90aaca608-d0b3f; Thu, 06 Sep 2018 12:19:23 +0800 (CST) X-RM-TRANSID: 2ee95b90aaca608-d0b3f From: Ding Xiang To: ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, linux-mips@linux-mips.org, linux-kernel@vger.kernel.org Cc: dingxiang@cmss.chinamobile.com Subject: [PATCH] mips: txx9: fix iounmap related issue Date: Thu, 6 Sep 2018 12:19:19 +0800 Message-Id: <1536207559-31543-1-git-send-email-dingxiang@cmss.chinamobile.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org if device_register return error, iounmap should be called, also iounmap need to call before put_device. Signed-off-by: Ding Xiang --- 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 f6d9182..70a1ab6 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c @@ -960,12 +960,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; } -- 1.9.1