diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2021-12-01 14:46:42 +0300 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2022-01-14 17:15:45 +0300 |
commit | ba7e3fd19a6731747da4d213566e4239b28d3a7d (patch) | |
tree | b98df600162e7372618adfcff367181279e94c57 /drivers | |
parent | ffe9d02e4152ab653652717a1907d0058b764d58 (diff) | |
download | linux-ba7e3fd19a6731747da4d213566e4239b28d3a7d.tar.xz |
agp/ati: Return error from ati_create_page_map()
Fix the compiler warning
drivers/char/agp/ati-agp.c: In function 'ati_create_page_map':
drivers/char/agp/ati-agp.c:58:16: warning: variable 'err' set but not used [-Wunused-but-set-variable]
58 | int i, err = 0;
by returing the error to the caller.
v2:
* free page in error branch (Helge)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Helge Deller <deller@gmx.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20211201114645.15384-5-tzimmermann@suse.de
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/agp/ati-agp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c index 857b37141a07..6f5530482d83 100644 --- a/drivers/char/agp/ati-agp.c +++ b/drivers/char/agp/ati-agp.c @@ -55,7 +55,7 @@ static struct _ati_generic_private { static int ati_create_page_map(struct ati_page_map *page_map) { - int i, err = 0; + int i, err; page_map->real = (unsigned long *) __get_free_page(GFP_KERNEL); if (page_map->real == NULL) @@ -63,6 +63,10 @@ static int ati_create_page_map(struct ati_page_map *page_map) set_memory_uc((unsigned long)page_map->real, 1); err = map_page_into_agp(virt_to_page(page_map->real)); + if (err) { + free_page((unsigned long)page_map->real); + return err; + } page_map->remapped = page_map->real; for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { |