All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alberto Garcia <berto@igalia.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, "Bin Meng" <bmeng.cn@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@mailo.com>,
	"Jan Kiszka" <jan.kiszka@siemens.com>,
	qemu-stable@nongnu.org
Subject: Re: [PATCH] hw/sd/sdcard: Register device ops in drives without media
Date: Thu, 23 Jul 2026 23:10:08 +0200	[thread overview]
Message-ID: <amKDMCpAbalcsFc9@igalia.com> (raw)
In-Reply-To: <20260723205847.137001-1-berto@igalia.com>

On Thu, Jul 23, 2026 at 10:58:39PM +0200, Alberto Garcia wrote:
> -    if (blk_size >= 0) {
> -        blk_size -= sd->boot_part_size * 2 + sd->rpmb_part_size;
> -        if (blk_size > SDSC_MAX_CAPACITY) {
> -            if (sd_is_emmc(sd) &&
[...]
> +        int64_t blk_size = blk_getlength(sd->blk);
> +        if (blk_size >= 0) {
> +            blk_size -= sd->boot_part_size * 2 + sd->rpmb_part_size;
> +            if (blk_size > SDSC_MAX_CAPACITY) {
> +                if (sd_is_emmc(sd) &&
[...]

There's a bit of churn here because I'm moving a whole block inside
another one, because I think that the resulting code reads better, but
we can of course keep the patch simpler if you prefer:

@@ -3145,7 +3145,9 @@ static void sd_realize(DeviceState *dev, Error **errp)
             error_setg(errp, "eMMC image smaller than boot partitions");
             return;
         }
+    }
 
+    if (sd->blk) {
         ret = blk_set_perm(sd->blk, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE,
                            BLK_PERM_ALL, errp);
         if (ret < 0) {

Berto


      reply	other threads:[~2026-07-23 21:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 20:58 [PATCH] hw/sd/sdcard: Register device ops in drives without media Alberto Garcia
2026-07-23 21:10 ` Alberto Garcia [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=amKDMCpAbalcsFc9@igalia.com \
    --to=berto@igalia.com \
    --cc=bmeng.cn@gmail.com \
    --cc=jan.kiszka@siemens.com \
    --cc=philmd@mailo.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.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 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.