From: Helge Deller <deller@gmx.de>
To: Thomas Zimmermann <tzimmermann@suse.de>,
airlied@linux.ie, daniel.vetter@ffwll.ch, arnd@arndb.de,
gregkh@linuxfoundation.org,
James.Bottomley@HansenPartnership.com
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/7] agp/ati: Return error from ati_create_page_map()
Date: Tue, 30 Nov 2021 11:11:06 +0100 [thread overview]
Message-ID: <6a73a2c8-1055-ebd5-7f12-dd34e86b7f2d@gmx.de> (raw)
In-Reply-To: <20211112141628.12904-5-tzimmermann@suse.de>
On 11/12/21 15:16, Thomas Zimmermann wrote:
> 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.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/char/agp/ati-agp.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
> index 857b37141a07..785cc1ecf4e0 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,8 @@ 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)
> + goto err_free_page;
I'd suggest to not use goto here, but instead simply fold
in the free_page() and return.
> page_map->remapped = page_map->real;
>
> for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) {
> @@ -71,6 +73,10 @@ static int ati_create_page_map(struct ati_page_map *page_map)
> }
>
> return 0;
> +
> +err_free_page:
> + free_page((unsigned long)page_map->real);
> + return err;
> }
>
>
>
next prev parent reply other threads:[~2021-11-30 10:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-12 14:16 [PATCH 0/7] agp: Various minor fixes Thomas Zimmermann
2021-11-12 14:16 ` [PATCH 1/7] agp: Remove trailing whitespaces Thomas Zimmermann
2021-11-12 14:16 ` [PATCH 2/7] agp: Include "compat_ioctl.h" where necessary Thomas Zimmermann
2021-11-12 14:16 ` [PATCH 3/7] agp: Documentation fixes Thomas Zimmermann
2021-11-12 14:16 ` [PATCH 4/7] agp/ati: Return error from ati_create_page_map() Thomas Zimmermann
2021-11-30 10:11 ` Helge Deller [this message]
2021-11-12 14:16 ` [PATCH 5/7] agp/nvidia: Ignore value returned by readl() Thomas Zimmermann
2021-11-30 10:13 ` Helge Deller
2021-11-12 14:16 ` [PATCH 6/7] agp/sworks: Remove unused variable 'current_size' Thomas Zimmermann
2021-11-12 14:16 ` [PATCH 7/7] agp/via: " Thomas Zimmermann
2021-11-30 10:03 ` [PATCH 0/7] agp: Various minor fixes Thomas Zimmermann
2021-11-30 10:17 ` Helge Deller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a73a2c8-1055-ebd5-7f12-dd34e86b7f2d@gmx.de \
--to=deller@gmx.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=airlied@linux.ie \
--cc=arnd@arndb.de \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).