Simplify chain of pointer dereferences with dev_of_node() which also
checks if 'dev' argument is non-NULL.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 5afac09c0d33..b1db1b597901 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -91,7 +91,7 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi)
struct platform_device *phy_pdev;
struct device_node *phy_node;
- phy_node = of_parse_phandle(pdev->dev.of_node, "phys", 0);
+ phy_node = of_parse_phandle(dev_of_node(&pdev->dev), "phys", 0);
if (!phy_node) {
DRM_DEV_ERROR(&pdev->dev, "cannot find phy device\n");
return -ENXIO;
@@ -287,7 +287,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
spin_lock_init(&hdmi->reg_lock);
mutex_init(&hdmi->state_mutex);
- ret = drm_of_find_panel_or_bridge(pdev->dev.of_node, 1, 0, NULL, &hdmi->next_bridge);
+ ret = drm_of_find_panel_or_bridge(dev_of_node(dev), 1, 0, NULL, &hdmi->next_bridge);
if (ret && ret != -ENODEV)
return ret;
--
2.51.0
On Wed, Mar 11, 2026 at 09:17:25PM +0100, Krzysztof Kozlowski wrote:
> Simplify chain of pointer dereferences with dev_of_node() which also
> checks if 'dev' argument is non-NULL.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> index 5afac09c0d33..b1db1b597901 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> @@ -91,7 +91,7 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi)
> struct platform_device *phy_pdev;
> struct device_node *phy_node;
>
> - phy_node = of_parse_phandle(pdev->dev.of_node, "phys", 0);
> + phy_node = of_parse_phandle(dev_of_node(&pdev->dev), "phys", 0);
> if (!phy_node) {
> DRM_DEV_ERROR(&pdev->dev, "cannot find phy device\n");
> return -ENXIO;
> @@ -287,7 +287,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
> spin_lock_init(&hdmi->reg_lock);
> mutex_init(&hdmi->state_mutex);
>
> - ret = drm_of_find_panel_or_bridge(pdev->dev.of_node, 1, 0, NULL, &hdmi->next_bridge);
> + ret = drm_of_find_panel_or_bridge(dev_of_node(dev), 1, 0, NULL, &hdmi->next_bridge);
dev_of_node(&pdev->dev)?
> if (ret && ret != -ENODEV)
> return ret;
>
>
> --
> 2.51.0
>
--
With best wishes
Dmitry
On 12/03/2026 03:41, Dmitry Baryshkov wrote:
> On Wed, Mar 11, 2026 at 09:17:25PM +0100, Krzysztof Kozlowski wrote:
>> Simplify chain of pointer dereferences with dev_of_node() which also
>> checks if 'dev' argument is non-NULL.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
>> ---
>> drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
>> index 5afac09c0d33..b1db1b597901 100644
>> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
>> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
>> @@ -91,7 +91,7 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi)
>> struct platform_device *phy_pdev;
>> struct device_node *phy_node;
>>
>> - phy_node = of_parse_phandle(pdev->dev.of_node, "phys", 0);
>> + phy_node = of_parse_phandle(dev_of_node(&pdev->dev), "phys", 0);
>> if (!phy_node) {
>> DRM_DEV_ERROR(&pdev->dev, "cannot find phy device\n");
>> return -ENXIO;
>> @@ -287,7 +287,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
>> spin_lock_init(&hdmi->reg_lock);
>> mutex_init(&hdmi->state_mutex);
>>
>> - ret = drm_of_find_panel_or_bridge(pdev->dev.of_node, 1, 0, NULL, &hdmi->next_bridge);
>> + ret = drm_of_find_panel_or_bridge(dev_of_node(dev), 1, 0, NULL, &hdmi->next_bridge);
>
> dev_of_node(&pdev->dev)?
Why? dev is already simpler.
Best regards,
Krzysztof
On Thu, Mar 12, 2026 at 05:32:02PM +0100, Krzysztof Kozlowski wrote:
> On 12/03/2026 03:41, Dmitry Baryshkov wrote:
> > On Wed, Mar 11, 2026 at 09:17:25PM +0100, Krzysztof Kozlowski wrote:
> >> Simplify chain of pointer dereferences with dev_of_node() which also
> >> checks if 'dev' argument is non-NULL.
> >>
> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> >> ---
> >> drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> >> index 5afac09c0d33..b1db1b597901 100644
> >> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> >> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> >> @@ -91,7 +91,7 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi)
> >> struct platform_device *phy_pdev;
> >> struct device_node *phy_node;
> >>
> >> - phy_node = of_parse_phandle(pdev->dev.of_node, "phys", 0);
> >> + phy_node = of_parse_phandle(dev_of_node(&pdev->dev), "phys", 0);
> >> if (!phy_node) {
> >> DRM_DEV_ERROR(&pdev->dev, "cannot find phy device\n");
> >> return -ENXIO;
> >> @@ -287,7 +287,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
> >> spin_lock_init(&hdmi->reg_lock);
> >> mutex_init(&hdmi->state_mutex);
> >>
> >> - ret = drm_of_find_panel_or_bridge(pdev->dev.of_node, 1, 0, NULL, &hdmi->next_bridge);
> >> + ret = drm_of_find_panel_or_bridge(dev_of_node(dev), 1, 0, NULL, &hdmi->next_bridge);
> >
> > dev_of_node(&pdev->dev)?
>
> Why? dev is already simpler.
... and there is no struct device *dev in msm_hdmi_get_phy().
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
© 2016 - 2026 Red Hat, Inc.