On Wed, Aug 21, 2024 at 10:50:47PM +0100, David Woodhouse wrote:
...
quoted hunk ↗ jump to hunk
diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c
...
+#define VMCLOCK_FIELD_PRESENT(_c, _f) \
+ (_c)->size >= (offsetof(struct vmclock_abi, _f) + \
+ sizeof((_c)->_f))
+
...
+static int vmclock_probe(struct platform_device *pdev)
...
+ /* If there is valid clock information, register a PTP clock */
+ if (VMCLOCK_FIELD_PRESENT(st->clk, time_frac_sec)) {
Hi David,
Sorry to be always the one with the nit-pick.
Sparse complains about the line above, I believe because the
type of st->clk->size is __le32.
.../ptp_vmclock.c:562:13: warning: restricted __le32 degrades to integer
+ /* Can return a silent NULL, or an error. */
+ st->ptp_clock = vmclock_ptp_register(dev, st);
+ if (IS_ERR(st->ptp_clock)) {
+ ret = PTR_ERR(st->ptp_clock);
+ st->ptp_clock = NULL;
+ vmclock_remove(pdev);
+ goto out;
+ }
+ }
...