All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: xypron.glpk@gmx.de, agraf@csgraf.de
Cc: u-boot@lists.denx.de, AKASHI Takahiro <takahiro.akashi@linaro.org>
Subject: [PATCH] efi_driver: simplify efi_bl_bind()
Date: Mon, 13 Sep 2021 15:01:47 +0900	[thread overview]
Message-ID: <20210913060147.18761-1-takahiro.akashi@linaro.org> (raw)

blk_create_devicef() is what blk_create_device() +
device_set_name_alloced() really does.
The resultant name will be a bit changed.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 lib/efi_driver/efi_block_device.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c
index 0937e3595a43..b81c75868eb4 100644
--- a/lib/efi_driver/efi_block_device.c
+++ b/lib/efi_driver/efi_block_device.c
@@ -159,15 +159,11 @@ static int efi_bl_bind(efi_handle_t handle, void *interface)
 	sprintf(name, "efiblk#%d", devnum);
 
 	/* Create driver model udevice for the EFI block io device */
-	ret = blk_create_device(parent, "efi_blk", name, IF_TYPE_EFI, devnum,
-				io->media->block_size,
-				(lbaint_t)io->media->last_block, &bdev);
+	ret = blk_create_devicef(parent, "efi_blk", name, IF_TYPE_EFI, devnum,
+				 io->media->block_size,
+				 (lbaint_t)io->media->last_block, &bdev);
 	if (ret)
 		return ret;
-	if (!bdev)
-		return -ENOENT;
-	/* Set the DM_FLAG_NAME_ALLOCED flag to avoid a memory leak */
-	device_set_name_alloced(bdev);
 
 	plat = dev_get_plat(bdev);
 	plat->handle = handle;
-- 
2.33.0


             reply	other threads:[~2021-09-13  6:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13  6:01 AKASHI Takahiro [this message]
2021-09-13  9:19 ` [PATCH] efi_driver: simplify efi_bl_bind() Heinrich Schuchardt
2021-09-13  9:50   ` AKASHI Takahiro
2021-09-30  4:09 ` Simon Glass

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=20210913060147.18761-1-takahiro.akashi@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.