From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Suraj Kandpal" <suraj.kandpal@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/ddi: Fix i2c_adapter assignment
Date: Thu, 05 Oct 2023 13:27:36 +0300 [thread overview]
Message-ID: <87r0m9cqjr.fsf@intel.com> (raw)
In-Reply-To: <ZR6E9jqTJzVWFwqi@intel.com>
On Thu, 05 Oct 2023, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Thu, Oct 05, 2023 at 12:12:58PM +0530, Suraj Kandpal wrote:
>> i2c_adapter is being assigned using intel_connector even before the
>> NULL check occurs and even though it shouldn't be a problem
>> lets just clean this up as logically it does not make sense to check
>> the connector for NULL but dereference it before that.
>>
>> Fixes: e046d1562491 ("drm/i915/hdmi: Use connector->ddc everwhere")
>>
>> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
>> ---
>> drivers/gpu/drm/i915/display/intel_ddi.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
>> index 4668de45d6fe..6b658faf1fc3 100644
>> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
>> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
>> @@ -4326,7 +4326,7 @@ static int intel_hdmi_reset_link(struct intel_encoder *encoder,
>> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>> struct intel_hdmi *hdmi = enc_to_intel_hdmi(encoder);
>> struct intel_connector *connector = hdmi->attached_connector;
>> - struct i2c_adapter *ddc = connector->base.ddc;
>> + struct i2c_adapter *ddc;
>> struct drm_connector_state *conn_state;
>> struct intel_crtc_state *crtc_state;
>> struct intel_crtc *crtc;
>> @@ -4336,6 +4336,8 @@ static int intel_hdmi_reset_link(struct intel_encoder *encoder,
>> if (!connector || connector->base.status != connector_status_connected)
>> return 0;
>
> The connector is never NULL here. So the check is just nonsense.
Yeah I'd rather remove that. Leaving it in makes people (and static
analyzers, apprently) think it could be NULL, and that leads to more
what ifs.
BR,
Jani.
>
>>
>> + ddc = connector->base.ddc;
>> +
>> ret = drm_modeset_lock(&dev_priv->drm.mode_config.connection_mutex,
>> ctx);
>> if (ret)
>> --
>> 2.25.1
--
Jani Nikula, Intel
next prev parent reply other threads:[~2023-10-05 10:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 6:42 [Intel-gfx] [PATCH] drm/i915/ddi: Fix i2c_adapter assignment Suraj Kandpal
2023-10-05 7:39 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2023-10-05 9:11 ` [Intel-gfx] [PATCH] " Andi Shyti
2023-10-05 9:31 ` Kandpal, Suraj
2023-10-05 9:42 ` Ville Syrjälä
2023-10-05 10:27 ` Jani Nikula [this message]
2023-10-05 10:47 ` Kandpal, Suraj
2023-10-05 11:10 ` [Intel-gfx] [PATCH] drm/i915/ddi: Remove redundant intel_connector NULL check Suraj Kandpal
2023-10-05 12:24 ` Andi Shyti
2023-10-06 7:28 ` Suraj Kandpal
2023-10-07 6:31 ` Andi Shyti
2023-10-05 22:38 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/ddi: Fix i2c_adapter assignment (rev2) Patchwork
2023-10-06 14:00 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/ddi: Fix i2c_adapter assignment (rev3) Patchwork
2023-10-07 3:13 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
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=87r0m9cqjr.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=suraj.kandpal@intel.com \
--cc=ville.syrjala@linux.intel.com \
/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.