[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 6/9] hw/sd/sdcard: Simplify realize() a bit
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 6/9] hw/sd/sdcard: Simplify realize() a bit |
Date: |
Tue, 14 Jul 2020 15:58:11 +0200 |
We don't need to check if sd->blk is set twice.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20200630133912.9428-18-f4bug@amsat.org>
---
hw/sd/sd.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 1cc16bfd31..edd60a09c0 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -2105,12 +2105,12 @@ static void sd_realize(DeviceState *dev, Error **errp)
return;
}
- if (sd->blk && blk_is_read_only(sd->blk)) {
- error_setg(errp, "Cannot use read-only drive as SD card");
- return;
- }
-
if (sd->blk) {
+ if (blk_is_read_only(sd->blk)) {
+ error_setg(errp, "Cannot use read-only drive as SD card");
+ return;
+ }
+
ret = blk_set_perm(sd->blk, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE,
BLK_PERM_ALL, errp);
if (ret < 0) {
--
2.21.3
- [PULL 0/9] sdcard: Fix CVE-2020-13253, Philippe Mathieu-Daudé, 2020/07/14
- [PULL 1/9] MAINTAINERS: Cc qemu-block mailing list, Philippe Mathieu-Daudé, 2020/07/14
- [PULL 2/9] docs/orangepi: Add instructions for resizing SD image to power of two, Philippe Mathieu-Daudé, 2020/07/14
- [PULL 3/9] tests/acceptance/boot_linux: Tag tests using a SD card with 'device:sd', Philippe Mathieu-Daudé, 2020/07/14
- [PULL 6/9] hw/sd/sdcard: Simplify realize() a bit,
Philippe Mathieu-Daudé <=
- [PULL 4/9] tests/acceptance/boot_linux: Expand SD card image to power of 2, Philippe Mathieu-Daudé, 2020/07/14
- [PULL 5/9] hw/sd/sdcard: Restrict Class 6 commands to SCSD cards, Philippe Mathieu-Daudé, 2020/07/14
- [PULL 7/9] hw/sd/sdcard: Do not allow invalid SD card sizes, Philippe Mathieu-Daudé, 2020/07/14
- [PULL 9/9] hw/sd/sdcard: Do not switch to ReceivingData if address is invalid, Philippe Mathieu-Daudé, 2020/07/14
- [PULL 8/9] hw/sd/sdcard: Update coding style to make checkpatch.pl happy, Philippe Mathieu-Daudé, 2020/07/14
- Re: [PULL 0/9] sdcard: Fix CVE-2020-13253, Peter Maydell, 2020/07/15