All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	linux-clk@vger.kernel.org
Subject: Re: [PATCH v11 5/6] clk: scmi: Introduce common header for SCMI clock interface
Date: Mon, 17 Aug 2026 11:08:41 +0000	[thread overview]
Message-ID: <20260817110842.3D3351F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260817-clk-v11-v11-5-36e9bc701b11@nxp.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Medium] Architecture / Unsafe Global State Exposure
- [Low] Compilation Error / Missing Include
- [Low] Header Incompleteness / Missing Includes
- [Low] Linker Error / Missing Export
--

--- Patch [5]: [PATCH v11 5/6] clk: scmi: Introduce common header for SCMI clock interface ---
commit 543bf2610f13161874461756bcae09693a9e083b
Author: Peng Fan <peng.fan@nxp.com>

clk: scmi: Introduce common header for SCMI clock interface

Added a new header file 'clk-scmi.h' to define common structures and
interfaces for the SCMI clock driver. This header will also be used by
OEM-specific extensions to ensure consistency and reusability.

> diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
> index 7c562559ad8bb..d88e78cc9a12e 100644
> --- a/drivers/clk/clk-scmi.c
> +++ b/drivers/clk/clk-scmi.c
> @@ -13,32 +13,7 @@
>  #include <linux/module.h>
>  #include <linux/scmi_protocol.h>

[Severity: Low]
Is an #include "clk-scmi.h" missing here?

Since struct scmi_clk and to_scmi_clk were moved to the new header, they will
be undefined in this file without the include. For example, in
scmi_clk_recalc_rate(), struct scmi_clk *clk = to_scmi_clk(hw); will trigger a
compilation error.

>  
> -#define NOT_ATOMIC	false
> -#define ATOMIC		true

[ ... ]

> -
> -#define to_scmi_clk(clk) container_of(clk, struct scmi_clk, hw)
> +const struct scmi_clk_proto_ops *scmi_proto_clk_ops;

[Severity: Low]
If this global variable is meant to be shared via extern for OEM modules, does
it need EXPORT_SYMBOL_GPL(scmi_proto_clk_ops)?

Without it, external modules will likely encounter linker errors when they
attempt to use it.

[Severity: Medium]
Could this global state exposure lead to a NULL pointer dereference?

The pointer is populated asynchronously during probe in scmi_clocks_probe():

	scmi_proto_clk_ops =
		handle->devm_protocol_get(sdev, SCMI_PROTOCOL_CLOCK, &ph);

If an external OEM module loads and accesses scmi_proto_clk_ops before the
main driver completes probe, it could dereference a NULL pointer.

> diff --git a/drivers/clk/clk-scmi.h b/drivers/clk/clk-scmi.h
> new file mode 100644
> index 0000000000000..6ef6adc77c836
> --- /dev/null
> +++ b/drivers/clk/clk-scmi.h
> @@ -0,0 +1,40 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + *  Copyright 2025 NXP
> + */
> +
> +#ifndef __SCMI_CLK_H
> +#define __SCMI_CLK_H
> +
> +#include <linux/bits.h>
> +#include <linux/scmi_protocol.h>
> +#include <linux/types.h>
> +

[ ... ]

> +
> +struct scmi_clk {
> +	u32 id;
> +	struct device *dev;
> +	struct clk_hw hw;

[Severity: Low]
Should this header include <linux/clk-provider.h>?

It embeds struct clk_hw hw by value, which requires the full definition of the
struct. Any external source file including clk-scmi.h that hasn't previously
included <linux/clk-provider.h> will fail to compile.

> +	const struct scmi_clock_info *info;
> +	const struct scmi_protocol_handle *ph;
> +	struct clk_parent_data *parent_data;
> +};
> +
> +#define to_scmi_clk(clk) container_of(clk, struct scmi_clk, hw)
> +
> +extern const struct scmi_clk_proto_ops *scmi_proto_clk_ops;
> +
> +#endif

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260817-clk-v11-v11-0-36e9bc701b11@nxp.com?part=5

  reply	other threads:[~2026-08-17 11:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 10:59 [PATCH v11 0/6] clk: Support spread spectrum and use it in clk-scmi Peng Fan (OSS)
2026-08-17 10:59 ` [PATCH v11 1/6] dt-bindings: clock: Add spread spectrum definition Peng Fan (OSS)
2026-08-17 10:59 ` [PATCH v11 2/6] clk: Introduce clk_hw_set_spread_spectrum Peng Fan (OSS)
2026-08-17 11:04   ` sashiko-bot
2026-08-17 10:59 ` [PATCH v11 3/6] clk: conf: Support assigned-clock-sscs Peng Fan (OSS)
2026-08-17 11:04   ` sashiko-bot
2026-08-17 10:59 ` [PATCH v11 4/6] clk: Add KUnit tests for assigned-clock-sscs Peng Fan (OSS)
2026-08-17 11:07   ` sashiko-bot
2026-08-17 10:59 ` [PATCH v11 5/6] clk: scmi: Introduce common header for SCMI clock interface Peng Fan (OSS)
2026-08-17 11:08   ` sashiko-bot [this message]
2026-08-17 10:59 ` [PATCH v11 6/6] clk: scmi: Add i.MX95 OEM extension support for SCMI clock driver Peng Fan (OSS)
2026-08-17 11:16   ` sashiko-bot

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=20260817110842.3D3351F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=peng.fan@oss.nxp.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.