Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3981279imm; Wed, 5 Sep 2018 08:53:28 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbZp0FBprZJCGE+oM6+t6JQf5lAXCgHhhTq8FP4E0qOmC8ACxZwsQjvNBdjtwzNAAH5DPd+ X-Received: by 2002:a17:902:558f:: with SMTP id g15-v6mr39544432pli.38.1536162808054; Wed, 05 Sep 2018 08:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536162808; cv=none; d=google.com; s=arc-20160816; b=Q7ThI2QKRSlDV2TbsXunc6/aYIqKcraQP2jtFzJVMvxZmy1ucEnoSr0zcZv7PmerWU iYRSaLG/r0LkQKlBN3z9vkNY9JF9r2RAdNxdHSVr3GJeKI1rK/zNCoEnUm9tKDTfROWl FXkJY1pz5QrggbVnnv+Q3hMRFRKrPegG4g4DFkmCZqJrG27HlUfi6nP8bavdWUIIenK8 YA1ow4pp44cEGdlenjUu5Q/XJjyhTQLfngleFnvDHAdjwv+Xzx1tHAdIw1a2UyQp+Q5v /PjELedXnHfp1rFs6DYXiN6G43SUunEBLtMTac8c0HzVhuOUjHYPNvMyuZnSXRlKs05Z SbbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=ceYBzaUnDmYPJj72YUYtz7BjTkwLTQpqFbdKjmj1VxQ=; b=iZ7NenFChWnmJPejvJwH+iAJeQHXntPXPY7zxrKBstNrrUUfzUVAaTtVwQdHd4MrSe ckhDoWticwCSee9KIdLhHNxGA+zsBzS7ziK1wSxxWNco5U02LDWypOpVkmFTOFdKBbGw Kx8YQL4VcW7iaXxN+b8GUA3A1JXZcaapVoLD1WklpwUMgEt9XSlTHREEzzvN0Ix4oCUb tpVe0VG4AYS7r9bUwbWRkUK02l5guBnq1wogl4moenIZGsFgNwANuObrvyUdiTYVOYh0 ZM+eWwWBjdYOxWlsASMdYM9VBrzF2+mx1ONCLAk6+/kQ4jRwx8ZZEGpZZj8RfV1hkKTf 1wyQ== 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 w10-v6si2479897pgh.342.2018.09.05.08.53.12; Wed, 05 Sep 2018 08:53:28 -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 S1727628AbeIEUV0 (ORCPT + 99 others); Wed, 5 Sep 2018 16:21:26 -0400 Received: from mfdf0181.ocn.ad.jp ([153.128.50.75]:50843 "EHLO mfdf0181.ocn.ad.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726335AbeIEUV0 (ORCPT ); Wed, 5 Sep 2018 16:21:26 -0400 X-Greylist: delayed 814 seconds by postgrey-1.27 at vger.kernel.org; Wed, 05 Sep 2018 16:21:25 EDT Received: from mogw0633.ocn.ad.jp (mogw0633.ocn.ad.jp [153.149.228.34]) by mfdf0181.ocn.ad.jp (Postfix) with ESMTP id D7B9F501D57 for ; Thu, 6 Sep 2018 00:37:07 +0900 (JST) Received: from mf-smf-ucb022c1 (mf-smf-ucb022c1.ocn.ad.jp [153.153.66.139]) by mogw0633.ocn.ad.jp (Postfix) with ESMTP id 283D0E8023E; Thu, 6 Sep 2018 00:37:06 +0900 (JST) Received: from ntt.pod01.mv-mta-ucb027 ([153.149.142.101]) by mf-smf-ucb022c1 with ESMTP id xZrPfBvBHeuR1xZrefi78h; Thu, 06 Sep 2018 00:37:06 +0900 Received: from smtp.ocn.ne.jp ([153.149.227.167]) by ntt.pod01.mv-mta-ucb027 with id Xrd51y0043dLKTM01rd5gw; Wed, 05 Sep 2018 15:37:06 +0000 Received: from localhost (p935071-ipngn2102funabasi.chiba.ocn.ne.jp [180.56.175.71]) by smtp.ocn.ne.jp (Postfix) with ESMTPA; Thu, 6 Sep 2018 00:37:05 +0900 (JST) Date: Thu, 06 Sep 2018 00:37:01 +0900 (JST) Message-Id: <20180906.003701.1191480642819924726.anemo@mba.ocn.ne.jp> To: dingxiang@cmss.chinamobile.com Cc: ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, linux-mips@linux-mips.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] mips: txx9: fix resource leak after register fail From: Atsushi Nemoto In-Reply-To: <1536146539-26131-1-git-send-email-dingxiang@cmss.chinamobile.com> References: <1536146539-26131-1-git-send-email-dingxiang@cmss.chinamobile.com> X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A B746 CA77 FE94 2874 D52F X-Pgp-Public-Key: http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=0x2874D52F X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 5 Sep 2018 19:22:19 +0800, Ding Xiang wrote: > the memory allocated and ioremap address need free after > device_register return error. ... > exit_put: > put_device(&dev->dev); > - return; > +exit_free: > + iounmap(dev->base); > + kfree(dev); This change will break exit_put error path. I think kfree will be called from txx9_device_release by put_device. Please refer James's comment on previous trial: --- Atsushi Nemoto