mailarchive of the pengutronix oss-tools mailing list
 help / color / mirror / Atom feed
From: "Enrico Jörns" <ejo@pengutronix.de>
To: oss-tools@pengutronix.de
Subject: [OSS-Tools] [PATCH dt-utils 3/5] libdt: error handling for udev read of ID_PART_TABLE_TYPE
Date: Tue, 27 Jan 2026 13:12:59 +0100	[thread overview]
Message-ID: <20260127121322.3332573-3-ejo@pengutronix.de> (raw)
In-Reply-To: <20260127121322.3332573-1-ejo@pengutronix.de>

Since the code does not differentiate between not being able to detect
the partition type and being non-GPT, at least print an error message if
udev_device_get_property_value() returned NULL.

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
---
 src/libdt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/libdt.c b/src/libdt.c
index 72e8ab4..1bef154 100644
--- a/src/libdt.c
+++ b/src/libdt.c
@@ -2337,6 +2337,9 @@ static int cdev_from_block_device(struct udev_device *dev,
 
 		cdev->devpath = strdup(udev_device_get_devnode(best_match));
 		part_type = udev_device_get_property_value(best_match, "ID_PART_TABLE_TYPE");
+		if (!part_type) {
+			fprintf(stderr, "Can't read property ID_PART_TABLE_TYPE\n");
+		}
 		cdev->is_gpt_partitioned = part_type && !strcmp(part_type, "gpt");
 	}
 
-- 
2.47.3




  parent reply	other threads:[~2026-01-27 12:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27 12:12 [OSS-Tools] [PATCH dt-utils 1/5] meson.build: fix building with -Dbarebox-state=false Enrico Jörns
2026-01-27 12:12 ` [OSS-Tools] [PATCH dt-utils 2/5] state: helpful error message if state GUID cannot be found Enrico Jörns
2026-01-27 12:12 ` Enrico Jörns [this message]
2026-01-27 12:13 ` [OSS-Tools] [PATCH dt-utils 4/5] libdt: print error if device is not GPT-partitioned Enrico Jörns
2026-01-27 12:13 ` [OSS-Tools] [PATCH dt-utils 5/5] libdt: print error for failed udev_new() for consistency Enrico Jörns

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=20260127121322.3332573-3-ejo@pengutronix.de \
    --to=ejo@pengutronix.de \
    --cc=oss-tools@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox