Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753414AbdHOJCE convert rfc822-to-8bit (ORCPT ); Tue, 15 Aug 2017 05:02:04 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:51190 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752552AbdHOJCC (ORCPT ); Tue, 15 Aug 2017 05:02:02 -0400 Date: Tue, 15 Aug 2017 11:01:59 +0200 From: Boris Brezillon To: Anton Vasilyev Cc: David Woodhouse , ldv-project@linuxtesting.org, Richard Weinberger , linux-kernel@vger.kernel.org, Marek Vasut , linux-mtd@lists.infradead.org, Cyrille Pitchen , Brian Norris Subject: Re: [PATCH] mtd: plat-ram: use release_mem_region instead of release_resource Message-ID: <20170815110159.39ebdeb6@bbrezillon> In-Reply-To: <1502456103-1576-1-git-send-email-vasilyev@ispras.ru> References: <1502456103-1576-1-git-send-email-vasilyev@ispras.ru> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1406 Lines: 48 Le Fri, 11 Aug 2017 15:55:03 +0300, Anton Vasilyev a écrit : > Use api pair of request_mem_region and release_mem_region > instead of release_resource. > > Found by Linux Driver Verification project (linuxtesting. > > Signed-off-by: Anton Vasilyev > --- > drivers/mtd/maps/plat-ram.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c > index 5157289..baaf146 100644 > --- a/drivers/mtd/maps/plat-ram.c > +++ b/drivers/mtd/maps/plat-ram.c > @@ -82,6 +82,7 @@ static inline void platram_setrw(struct platram_info *info, int to) > static int platram_remove(struct platform_device *pdev) > { > struct platram_info *info = to_platram_info(pdev); > + resource_size_t res_size; > > dev_dbg(&pdev->dev, "removing device\n"); > > @@ -100,8 +101,8 @@ static int platram_remove(struct platform_device *pdev) > /* release resources */ > > if (info->area) { > - release_resource(info->area); > - kfree(info->area); > + res_size = resource_size(info->area) Missing semi-colon here, which means you did not even compile-test your changes :P. > + release_mem_region(info->area->start, res_size); Why adding a res_size variable instead of doing release_mem_region(info->area->start, resource_size(info->area); ? > } > > if (info->map.virt != NULL)