Message ID | 20230328080702.26.I5c93e458e2f7205b69ffef473ac7154a675fc9bd@changeid |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show
Return-Path: <u-boot-bounces@lists.denx.de> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=NOIb7aVD; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PljDV13vLz1yXv for <incoming@patchwork.ozlabs.org>; Tue, 28 Mar 2023 06:14:34 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DC2BB8617F; Mon, 27 Mar 2023 21:11:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NOIb7aVD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 008FC86119; Mon, 27 Mar 2023 21:10:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5C56185AEC for <u-boot@lists.denx.de>; Mon, 27 Mar 2023 21:10:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x102f.google.com with SMTP id o6-20020a17090a9f8600b0023f32869993so12816724pjp.1 for <u-boot@lists.denx.de>; Mon, 27 Mar 2023 12:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679944208; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AoBJ28QbP7QpDgqhI0GyzxF8MttgBLSPBevuTG9mAzk=; b=NOIb7aVDXLyRtJTRdQyeVFx3oE5qgHAKrdnKCBBq+cN6jFZ5Zkg7bV+RWlDxlCbwad 2z+92YqoMXNaznkIov+UYw3okbxlxUu3vOb2Fag252Wvi+0HCoAUYdRmbqiTY7LY1l3Q 5FeoYeMOIRbmyQwKUvc+hdQs8r+/r8505gJhQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679944208; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AoBJ28QbP7QpDgqhI0GyzxF8MttgBLSPBevuTG9mAzk=; b=jHuiSbqezoqlUupuYFgbnw09c2cRICH3cCKT2U1fLxMf1etAqL21kvXsMM6Snwd93w ZBc70ur8awRroJHZGQN1ED17K4BykRKtI4MMNOyTEO3HFPLe8I9S0YQrK8lrxiBVpQZY kNtcS1I+wvCyw58afMiuRI0+T/ygMq8I9pvvQBiRPi+IUPHP03qc9bYe8ikW8MdnsMRi OwI9BKpxdV2om5v7oCQi9vDpMuwGxR+byxEVggEr0p0T/hYrds9p2gCfvBZ13HurWYF/ Q6LfVaLLa2P5oZydPpSyuthHeOQWLx3GdFMFssO2IvH+KcBx2KTQiP/8Cp6W1mOuGrE9 sU2g== X-Gm-Message-State: AO0yUKUUB8uwUt0iqETFYg1TlKXDuKwXxGaSRPDkh5bDehJ3JCt1Hd0c SgdV/gKdamuB9RRPF6l0ocoIJjn1WkwOCXXKHUs= X-Google-Smtp-Source: AK7set+V3qYp2rx9KcE9hwgb30qHY97qFDq+RO6qcNp5RKeRn9B6f38Y9amGBBc9eHvDZKsyGkNAmw== X-Received: by 2002:a05:6a20:3f0c:b0:db:4c00:7918 with SMTP id az12-20020a056a203f0c00b000db4c007918mr10928538pzb.0.1679944208430; Mon, 27 Mar 2023 12:10:08 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id d9-20020aa78e49000000b005cd81a74821sm15653334pfr.152.2023.03.27.12.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 12:10:08 -0700 (PDT) From: Simon Glass <sjg@chromium.org> To: U-Boot Mailing List <u-boot@lists.denx.de> Cc: Bin Meng <bmeng.cn@gmail.com>, Simon Glass <sjg@chromium.org> Subject: [PATCH 26/30] ide: Correct LBA setting Date: Tue, 28 Mar 2023 08:07:13 +1300 Message-Id: <20230328080702.26.I5c93e458e2f7205b69ffef473ac7154a675fc9bd@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327190717.1796230-1-sjg@chromium.org> References: <20230327190717.1796230-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean |
Series |
ide: Clean up code and fix a few bugs
|
expand
|
diff --git a/drivers/block/ide.c b/drivers/block/ide.c index 4c2a6a8e5309..72216540d040 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -1029,9 +1029,7 @@ static int ide_probe(struct udevice *udev) for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; i++) { struct blk_desc *desc, pdesc; struct udevice *blk; - lbaint_t size; char name[20]; - int blksz; int ret; if (!bus_ok[IDE_BUS(i)]) @@ -1045,17 +1043,14 @@ static int ide_probe(struct udevice *udev) sprintf(name, "blk#%d", i); - blksz = pdesc.blksz; - size = blksz * pdesc.lba; - /* * With CDROM, if there is no CD inserted, blksz will * be zero, don't bother to create IDE block device. */ - if (!blksz) + if (!pdesc.blksz) continue; ret = blk_create_devicef(udev, "ide_blk", name, UCLASS_IDE, i, - blksz, size, &blk); + pdesc.blksz, pdesc.lba, &blk); if (ret) return ret;
Fix a longstanding bug where the LBA is calculated as the size of the media instead of the number of blocks. This was perhaps not noticed earlier since it prints the correct value first, before setting the wrong value. Drop the unnecessary blksz variable while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 68e6f221ed0 ("block: ide: Fix block read/write with driver model") --- drivers/block/ide.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)