Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752152AbdHHQ1B (ORCPT ); Tue, 8 Aug 2017 12:27:01 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:36288 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752062AbdHHQ1A (ORCPT ); Tue, 8 Aug 2017 12:27:00 -0400 MIME-Version: 1.0 In-Reply-To: <1502196356-11466-1-git-send-email-bianpan2016@163.com> References: <1502196356-11466-1-git-send-email-bianpan2016@163.com> From: Dmitry Torokhov Date: Tue, 8 Aug 2017 09:26:58 -0700 Message-ID: Subject: Re: firmware: vpd: use memunmap instead of iounmap To: Pan Bian Cc: Greg Kroah-Hartman , Guenter Roeck , Thierry Escande , Wei Yongjun , Christophe JAILLET , Wei-Ning Huang , lkml Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1724 Lines: 54 Hi Pan, On Tue, Aug 8, 2017 at 5:45 AM, Pan Bian wrote: > In functions vpd_sections_init() and vpd_section_init(), iounmap() is > used to unmap memory. However, in these cases, memunmap() is better. > > Signed-off-by: Pan Bian > --- > drivers/firmware/google/vpd.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/google/vpd.c > index 7894572..ac6400f 100644 > --- a/drivers/firmware/google/vpd.c > +++ b/drivers/firmware/google/vpd.c > @@ -234,7 +234,7 @@ static int vpd_section_init(const char *name, struct vpd_section *sec, > err_free_raw_name: > kfree(sec->raw_name); > err_iounmap: > - iounmap(sec->baseaddr); > + memunmap(sec->baseaddr); It would be great if you also adjusted the name of the error label. > return err; > } > > @@ -245,7 +245,7 @@ static int vpd_section_destroy(struct vpd_section *sec) > kobject_put(sec->kobj); > sysfs_remove_bin_file(vpd_kobj, &sec->bin_attr); > kfree(sec->raw_name); > - iounmap(sec->baseaddr); > + memunmap(sec->baseaddr); > } > > return 0; > @@ -262,7 +262,7 @@ static int vpd_sections_init(phys_addr_t physaddr) > return -ENOMEM; > > memcpy_fromio(&header, temp, sizeof(struct vpd_cbmem)); > - iounmap(temp); > + memunmap(temp); > > if (header.magic != VPD_CBMEM_MAGIC) > return -ENODEV; I think there is more confusion with memremap/iounmap and type of the header data structure. I think I need to refresh https://lkml.org/lkml/2017/5/23/1445 Thanks. -- Dmitry