From: Thomas Richard <thomas.richard@bootlin.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Lee Jones <lee@kernel.org>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mfd: cgbc-core: Fix error handling paths in cgbc_init_device()
Date: Mon, 28 Oct 2024 10:31:35 +0100 [thread overview]
Message-ID: <09e7baa9-8715-4f9c-924b-3e782dd3196f@bootlin.com> (raw)
In-Reply-To: <24ec1348b99e76a853435ab081ae9a8f0e51fd52.1729938747.git.christophe.jaillet@wanadoo.fr>
Hello Christophe,
On 10/26/24 12:32, Christophe JAILLET wrote:
> If an error occurs after a cgbc_session_request() call, it should be
> balanced by a corresponding cgbc_session_release(), as already done in the
> remove function.
>
> Fixes: 6f1067cfbee7 ("mfd: Add Congatec Board Controller driver")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only
> ---
> drivers/mfd/cgbc-core.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c
> index 93004a6b29c1..7771d010eb2e 100644
> --- a/drivers/mfd/cgbc-core.c
> +++ b/drivers/mfd/cgbc-core.c
> @@ -321,9 +321,19 @@ static int cgbc_init_device(struct cgbc_device_data *cgbc)
>
> ret = cgbc_get_version(cgbc);
> if (ret)
> - return ret;
> + goto release_session;
> +
> + ret = mfd_add_devices(cgbc->dev, -1, cgbc_devs, ARRAY_SIZE(cgbc_devs),
> + NULL, 0, NULL);
> + if (ret)
> + goto release_session;
> +
> + return 0;
> +
> +release_session:
> + cgbc_session_release(cgbc);
> + return ret;
>
> - return mfd_add_devices(cgbc->dev, -1, cgbc_devs, ARRAY_SIZE(cgbc_devs), NULL, 0, NULL);
> }
nitpick: useless blank line before the close brace.
Reviewed-by: Thomas Richard <thomas.richard@bootlin.com>
Regards,
Thomas
prev parent reply other threads:[~2024-10-28 9:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-26 10:32 Christophe JAILLET
2024-10-28 9:31 ` Thomas Richard [this message]
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=09e7baa9-8715-4f9c-924b-3e782dd3196f@bootlin.com \
--to=thomas.richard@bootlin.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®