From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AFFBAC7619A for ; Thu, 30 Mar 2023 21:40:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 98BD8860B2; Thu, 30 Mar 2023 23:38:00 +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="HaqU/jav"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D23E285F1F; Thu, 30 Mar 2023 23:36:19 +0200 (CEST) Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (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 DC7F985F5F for ; Thu, 30 Mar 2023 23:35:17 +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-x1029.google.com with SMTP id d13so18572052pjh.0 for ; Thu, 30 Mar 2023 14:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680212116; 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=jXF7v3ZW3STO/QS/6q+/yNoVK68s7ssy9LssCjQAtTI=; b=HaqU/javO8tGyFHraG9Xv8fhdANnbdtwveZGdnJtNIfuPpPEL5KH05xRkmaJ6OW3lJ z1JLywvpuLG6anylIQ/2jN/eS5MrT5Uk4jsVmyECg0ZlGECh65nNF2XxnMRwoptHukNZ o+aFdWSd8lw41f1HQ+tFA2uTgbybT0c7kxZuQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680212116; 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=jXF7v3ZW3STO/QS/6q+/yNoVK68s7ssy9LssCjQAtTI=; b=747EGNrG4Z0jKwIiNMOod98t6lZxGAmvbqX+PoR1kBGK6iHOIxrOf8kIUAYv8U27bA m7YBrxJjw7y2RyS4UyuIjmRIj7a9fuOWbH85PuCPnZzTcI1fON1lXvDxTUiL9zG7WnFR ER/CarCzsufE4HVONVmKmLki/dbSZMfjjwNQ2k/ygwZHCJaJ5HdrCLx8j2oM0UYoO6p+ 0q3eAc/jyABTzfjJfjGazZ9tT1BnDYoIlu4s7q5DMjPLgw2iPcbCwh03fIbdhsROR+9D STsizqWN3LqHlDfm3ZEHQHXC3bfnyrixq9OI6ZBFdJxBIt9HqV5aEPkiPKKC1rdkAbKR MlUQ== X-Gm-Message-State: AAQBX9eT6dpYIczgfMR8Hj5J3Y596cpCRvQOREHbBrIHIGdImPldOhNF Au6uXQKJ0SIvnIBZksysjrD4ZzA6uM0SOA5PIVg= X-Google-Smtp-Source: AKy350YjTLPf2QSYgkiQ+6RH+FHww1hTYHqlXX6Uf5kOX7Nh2zI1xiDk7USMT6TGNKIaz+C3Wfxr3Q== X-Received: by 2002:a17:903:120a:b0:1a2:9dd0:1f74 with SMTP id l10-20020a170903120a00b001a29dd01f74mr61353plh.54.1680212116122; Thu, 30 Mar 2023 14:35:16 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id q6-20020a170902b10600b001a282714f97sm144413plr.275.2023.03.30.14.35.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 14:35:15 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Heinrich Schuchardt , Simon Glass , =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= , Ilias Apalodimas Subject: [PATCH 32/38] fs: fat: Shrink the size of a few strings Date: Fri, 31 Mar 2023 10:32:21 +1300 Message-Id: <20230331103047.32.If2eea014ebc68815d68f373640c80a761a082f83@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230330213227.2142353-1-sjg@chromium.org> References: <20230330213227.2142353-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean To save a few bytes, replace Error with ** and try to use the same string for multiple messages where possible. Signed-off-by: Simon Glass --- fs/fat/fat.c | 12 ++++++------ fs/fat/fat_write.c | 14 ++++---------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 2da93dae3cf3..f0df7988e172 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -97,8 +97,8 @@ int fat_register_device(struct blk_desc *dev_desc, int part_no) /* Read the partition table, if present */ if (part_get_info(dev_desc, part_no, &info)) { if (part_no != 0) { - printf("** Partition %d not valid on device %d **\n", - part_no, dev_desc->devnum); + printf("** Partition %d invalid on device %d **\n", + part_no, dev_desc->devnum); return -1; } @@ -168,7 +168,7 @@ static __u32 get_fatent(fsdata *mydata, __u32 entry) __u32 ret = 0x00; if (CHECK_CLUST(entry, mydata->fatsize)) { - printf("Error: Invalid FAT entry: 0x%08x\n", entry); + printf("** Invalid FAT entry: %#08x\n", entry); return ret; } @@ -586,17 +586,17 @@ static int get_fs_info(fsdata *mydata) mydata->sect_size = (bs.sector_size[1] << 8) + bs.sector_size[0]; mydata->clust_size = bs.cluster_size; if (mydata->sect_size != cur_part_info.blksz) { - printf("Error: FAT sector size mismatch (fs=%hu, dev=%lu)\n", + printf("** FAT sector size mismatch (fs=%hu, dev=%lu)\n", mydata->sect_size, cur_part_info.blksz); return -1; } if (mydata->clust_size == 0) { - printf("Error: FAT cluster size not set\n"); + printf("** FAT cluster size not set\n"); return -1; } if ((unsigned int)mydata->clust_size * mydata->sect_size > MAX_CLUSTSIZE) { - printf("Error: FAT cluster size too big (cs=%u, max=%u)\n", + printf("** FAT cluster size too big (cs=%u, max=%u)\n", (unsigned int)mydata->clust_size * mydata->sect_size, MAX_CLUSTSIZE); return -1; diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index 00541ebc3a4a..4d2d4db07fa6 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -1568,8 +1568,9 @@ int fat_unlink(const char *filename) char *filename_copy, *dirname, *basename; filename_copy = strdup(filename); - if (!filename_copy) { - printf("Error: allocating memory\n"); + itr = malloc_cache_aligned(sizeof(fat_itr)); + if (!itr || !filename_copy) { + printf("Error: out of memory\n"); ret = -ENOMEM; goto exit; } @@ -1581,13 +1582,6 @@ int fat_unlink(const char *filename) goto exit; } - itr = malloc_cache_aligned(sizeof(fat_itr)); - if (!itr) { - printf("Error: allocating memory\n"); - ret = -ENOMEM; - goto exit; - } - ret = fat_itr_root(itr, &fsdata); if (ret) goto exit; @@ -1602,7 +1596,7 @@ int fat_unlink(const char *filename) } if (!find_directory_entry(itr, basename)) { - printf("%s: doesn't exist\n", basename); + printf("%s: doesn't exist (%d)\n", basename, -ENOENT); ret = -ENOENT; goto exit; } -- 2.40.0.348.gf938b09366-goog