Linux EFI development
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
To: Ard Biesheuvel <ardb+git@google.com>
Cc: linux-efi@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
	 Kees Cook <kees@kernel.org>,
	"Guilherme G. Piccoli" <gpiccoli@igalia.com>
Subject: Re: [PATCH 2/2] efi: pstore: Convert into a platform driver for 'efivars'
Date: Mon, 23 Nov 2026 10:04:10 +0100	[thread overview]
Message-ID: <awQAaoPBSeaTC17N@monoceros> (raw)
In-Reply-To: <20261120131827.480055-6-ardb+git@google.com>

[-- Attachment #1: Type: text/plain, Size: 2043 bytes --]

Hello Ard,

On Fri, Nov 20, 2026 at 02:18:30PM +0100, Ard Biesheuvel wrote:
> diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
> index 19a7e4fe5b52..44571fa1dd88 100644
> --- a/drivers/firmware/efi/efi-pstore.c
> +++ b/drivers/firmware/efi/efi-pstore.c
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0+
>  
>  #include <linux/efi.h>
> +#include <linux/mod_devicetable.h>

please don't add new users for <linux/mod_devicetable.h>.
<linux/platform_device.h> already provides platform_device_id without
introducing a big number of unneeded build dependencies.

>  #include <linux/module.h>
> +#include <linux/platform_device.h>
>  #include <linux/pstore.h>
>  #include <linux/slab.h>
>  #include <linux/ucs2_string.h>
> @@ -251,29 +258,53 @@ static __init int efivars_pstore_init(void)
>  
>  	efi_pstore_info.bufsize = record_size;
>  
> -	if (pstore_register(&efi_pstore_info)) {
> +	ret = pstore_register(&efi_pstore_info);
> +	if (ret) {
>  		kfree(efi_pstore_info.buf);
>  		efi_pstore_info.buf = NULL;
>  		efi_pstore_info.bufsize = 0;
> +		return ret;
>  	}
>  
>  	return 0;

this can be simplified:

 		kfree(efi_pstore_info.buf);
 		efi_pstore_info.buf = NULL;
 		efi_pstore_info.bufsize = 0;
-		return ret;
 	}
 
-	return 0;
+	return ret;

(though I think it's subjective if you like that or not.)

>  }
>  
> -static __exit void efivars_pstore_exit(void)
> +static void efi_pstore_remove(struct platform_device *pdev)
>  {
> -	if (!efi_pstore_info.bufsize)
> -		return;
> -
>  	pstore_unregister(&efi_pstore_info);
>  	kfree(efi_pstore_info.buf);
>  	efi_pstore_info.buf = NULL;
>  	efi_pstore_info.bufsize = 0;
>  }
>  
> +static const struct platform_device_id efi_pstore_ids[] = {
> +	{ "efivars", 0 },

Please don't initialize .driver_data unless you use it. Also ideally use
a designated initializer:

	{ .name = "efivars" },

> +	{ }
> +};
> +MODULE_DEVICE_TABLE(platform, efi_pstore_ids);

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      parent reply	other threads:[~2026-11-23  9:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 13:18 [PATCH 0/2] efi: Fix pstore runtime en/disable Ard Biesheuvel
2026-11-20 13:18 ` [PATCH 1/2] efi: pstore: Make pstore_disable parameter read-only again Ard Biesheuvel
2026-11-20 13:18 ` [PATCH 2/2] efi: pstore: Convert into a platform driver for 'efivars' Ard Biesheuvel
2026-11-20 13:39   ` sashiko-bot
2026-11-23  9:04   ` Uwe Kleine-König [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=awQAaoPBSeaTC17N@monoceros \
    --to=u.kleine-koenig@baylibre.com \
    --cc=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=gpiccoli@igalia.com \
    --cc=kees@kernel.org \
    --cc=linux-efi@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