Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/panthor: premature -ENODEV check in
  panthor_devfreq_init() skips DT OPP table
--

commit ab9f7c849faad8dd2154fb00865ae2985875a9a7
Author: Karunika Choo <[email protected]>

drm/panthor: Skip devfreq when no OPP table is present

This commit skips panthor devfreq initialization on Mali v15 AM systems
when no OPP table is present, guards the devfreq helpers against a NULL
devfreq pointer, and omits drm-maxfreq-panthor from fdinfo when fast_rate
is zero.

> diff --git a/drivers/gpu/drm/panthor/panthor_devfreq.c 
> b/drivers/gpu/drm/panthor/panthor_devfreq.c
> index 2249b41ca4afe..d1814b5197221 100644
> --- a/drivers/gpu/drm/panthor/panthor_devfreq.c
> +++ b/drivers/gpu/drm/panthor/panthor_devfreq.c
> @@ -12,6 +12,7 @@
>  
>  #include "panthor_devfreq.h"
>  #include "panthor_device.h"
> +#include "panthor_hw.h"
>  
>  /**
>   * struct panthor_devfreq - Device frequency management
> @@ -164,6 +165,19 @@ int panthor_devfreq_init(struct panthor_device *ptdev)
>        */
>       table = dev_pm_opp_get_opp_table(dev);
>       if (IS_ERR_OR_NULL(table)) {
> +             /*
> +              * On v15 GPUs, frequency scaling is handled outside of panthor
> +              * by the AM_GOVERNOR block, so the GPU DT node may not provide
> +              * an OPP table. In such cases, do not initialize devfreq for
> +              * panthor.
> +              */
> +             if (panthor_hw_is_gen5_am(ptdev->base.dev) &&
> +                 PTR_ERR(table) == -ENODEV) {
> +                     drmm_kfree(&ptdev->base, pdevfreq);
> +                     ptdev->devfreq = NULL;
> +                     return 0;
> +             }
> +
>               ret = devm_pm_opp_set_regulators(dev, reg_names);
>               if (ret && ret != -ENODEV) {
>                       if (ret != -EPROBE_DEFER)

[Severity: Medium]
Does checking PTR_ERR(table) == -ENODEV right after
dev_pm_opp_get_opp_table(dev) skip devfreq even when the GPU DT node
provides an OPP table?

dev_pm_opp_get_opp_table() only searches the in-memory opp_tables list for
a table already registered (for example by a power domain) and returns
ERR_PTR(-ENODEV) before devm_pm_opp_of_add_table(dev) has parsed the
Device Tree.  As a result, on arm,mali-gen5-am systems without a
pre-registered power-domain OPP table, panthor_devfreq_init() returns
early before devm_pm_opp_of_add_table(dev) is called, ignoring any OPP
table in the GPU DT node.  Should the -ENODEV check for
panthor_hw_is_gen5_am() happen on the return value of
devm_pm_opp_of_add_table(dev) instead?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=10

Reply via email to