linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: Gavin Shan <gshan@redhat.com>, linux-arm-kernel@lists.infradead.org
Cc: mark.rutland@arm.com, catalin.marinas@arm.com, will@kernel.org,
	shan.gavin@gmail.com, Jonathan.Cameron@huawei.com
Subject: Re: [PATCH v4 05/15] drivers/firmware/sdei: Unregister driver on error in sdei_init()
Date: Fri, 18 Sep 2020 17:12:22 +0100	[thread overview]
Message-ID: <773fcdde-05d6-8c35-2a9b-444af3fcee76@arm.com> (raw)
In-Reply-To: <20200730014531.310465-6-gshan@redhat.com>

Hi Gavin,

On 30/07/2020 02:45, Gavin Shan wrote:
> The platform driver needs to be unregistered on error to create the
> platform device, so that the state is restored to original one.

Why is this important? Is it just symmetry? 'needs' causes me to look at this as a bug-fix.

DT systems leave a dangling platform device in this case. Is that a problem?
See commit 3aa0582fdb82 ("of: platform: populate /firmware/ node from
of_platform_default_populate_init()").

On DT systems, sdei_init() doesn't create the platform device, so it doesn't remove it
either. ACPI leaves it dangling because ... why should ACPI behave differently?


> Besides, the errno (@ret) should be updated acccording in that case.

(according)


> diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
> index c9f2bedfb6b5..909f27abf8a7 100644
> --- a/drivers/firmware/arm_sdei.c
> +++ b/drivers/firmware/arm_sdei.c
> @@ -1090,9 +1090,12 @@ static int __init sdei_init(void)
>  
>  	pdev = platform_device_register_simple(sdei_driver.driver.name,
>  					       0, NULL, 0);
> -	if (IS_ERR(pdev))
> -		pr_info("Failed to register ACPI:SDEI platform device %ld\n",
> -			PTR_ERR(pdev));
> +	if (IS_ERR(pdev)) {
> +		ret = PTR_ERR(pdev);
> +		platform_driver_unregister(&sdei_driver);
> +		pr_info("Failed to register ACPI:SDEI platform device %d\n",
> +			ret);
> +	}
>  
>  	return ret;
>  }

If the argument here is about symmetry, sure. Please stuff sneak the word symmetry into
the commit message - I keep reading this as if its a bug. Its probably worth a comment in
the commit message that its only like this for ACPI. Previously the motivation was to keep
these things as similar as possible.

With that:
Reviewed-by: James Morse <james.morse@arm.com>


Thanks,

James

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-09-18 16:14 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30  1:45 [PATCH v4 00/15] Refactor SDEI client driver Gavin Shan
2020-07-30  1:45 ` [PATCH v4 01/15] drivers/firmware/sdei: Remove sdei_is_err() Gavin Shan
2020-07-30  1:45 ` [PATCH v4 02/15] drivers/firmware/sdei: Common block for failing path in sdei_event_create() Gavin Shan
2020-09-18 16:10   ` James Morse
2020-07-30  1:45 ` [PATCH v4 03/15] drivers/firmware/sdei: Retrieve event number from event instance Gavin Shan
2020-09-18 16:11   ` James Morse
2020-07-30  1:45 ` [PATCH v4 04/15] drivers/firmware/sdei: Avoid nested statements in sdei_init() Gavin Shan
2020-09-18 16:11   ` James Morse
2020-07-30  1:45 ` [PATCH v4 05/15] drivers/firmware/sdei: Unregister driver on error " Gavin Shan
2020-09-18 16:12   ` James Morse [this message]
2020-09-20  1:10     ` Gavin Shan
2020-07-30  1:45 ` [PATCH v4 06/15] drivers/firmware/sdei: Remove duplicate check in sdei_get_conduit() Gavin Shan
2020-09-18 16:12   ` James Morse
2020-07-30  1:45 ` [PATCH v4 07/15] drivers/firmware/sdei: Remove Drop redundant error message in sdei_probe() Gavin Shan
2020-09-18 16:12   ` James Morse
2020-07-30  1:45 ` [PATCH v4 08/15] drivers/firmware/sdei: Remove while loop in sdei_event_register() Gavin Shan
2020-09-18 16:13   ` James Morse
2020-09-20  2:18     ` Gavin Shan
2020-07-30  1:45 ` [PATCH v4 09/15] drivers/firmware/sdei: Remove while loop in sdei_event_unregister() Gavin Shan
2020-07-30  1:45 ` [PATCH v4 10/15] drivers/firmware/sdei: Cleanup on cross call function Gavin Shan
2020-09-18 16:13   ` James Morse
2020-07-30  1:45 ` [PATCH v4 11/15] drivers/firmware/sdei: Introduce sdei_do_local_call() Gavin Shan
2020-09-18 16:13   ` James Morse
2020-07-30  1:45 ` [PATCH v4 12/15] drivers/firmware/sdei: Remove _sdei_event_register() Gavin Shan
2020-09-18 16:14   ` James Morse
2020-07-30  1:45 ` [PATCH v4 13/15] drivers/firmware/sdei: Remove _sdei_event_unregister() Gavin Shan
2020-09-18 16:14   ` James Morse
2020-07-30  1:45 ` [PATCH v4 14/15] drivers/firmware/sdei: Expose struct sdei_event Gavin Shan
2020-07-30 10:54   ` Jonathan Cameron
2020-07-31  0:20     ` Gavin Shan
2020-09-18 16:15   ` James Morse
2020-09-20  2:42     ` Gavin Shan
2020-07-30  1:45 ` [PATCH v4 15/15] drivers/firmware/sdei: Identify event by " Gavin Shan
2020-07-30  8:03 ` [PATCH v4 00/15] Refactor SDEI client driver Gavin Shan
2020-08-27  6:55   ` Gavin Shan

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=773fcdde-05d6-8c35-2a9b-444af3fcee76@arm.com \
    --to=james.morse@arm.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=catalin.marinas@arm.com \
    --cc=gshan@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=shan.gavin@gmail.com \
    --cc=will@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;
as well as URLs for NNTP newsgroup(s).