From: Jani Nikula <jani.nikula@linux.intel.com>
To: wharms@bfs.de, Dan Carpenter <dan.carpenter@oracle.com>
Cc: intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
drm-intel-fixes@lists.freedesktop.org,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [patch] drm/i915: fix a read size argument
Date: Thu, 13 Oct 2016 12:13:11 +0000 [thread overview]
Message-ID: <87zim8wip4.fsf@intel.com> (raw)
In-Reply-To: <57FF5380.1080704@bfs.de>
On Thu, 13 Oct 2016, walter harms <wharms@bfs.de> wrote:
> Am 13.10.2016 10:55, schrieb Dan Carpenter:
>> We want to read 3 bytes here, but because the parenthesis are in the
>> wrong place we instead read:
>>
>> sizeof(intel_dp->edp_dpcd) = sizeof(intel_dp->edp_dpcd)
>>
>> which is one byte.
>>
>> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Dan, good catch, thank you. Luckily we only really use the first byte
currently...
Cc: <drm-intel-fixes@lists.freedesktop.org>
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 14a3cf0..ee8aa95 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>> /* Read the eDP Display control capabilities registers */
>> if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>> drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
>> - intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) =
>> - sizeof(intel_dp->edp_dpcd)))
>> + intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) =
>> + sizeof(intel_dp->edp_dpcd))
>
>
>
> perhaps we can morph that into something more readable ? I would suggest:
>
>
> if (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE)
> {
> size_t size=sizeof(intel_dp->edp_dpcd); /* = EDP_DISPLAY_CTL_CAP_SIZE */
> int ret;
>
> ret=drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,intel_dp->edp_dpcd,size);
>
> if (ret != size )
> ......
>
> }
>
> this way it improves readability and reduces line length.
Not convinced, let's just take the simple brace fix now.
BR,
Jani.
--
Jani Nikula, Intel Open Source Technology Center
WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: wharms@bfs.de, Dan Carpenter <dan.carpenter@oracle.com>
Cc: intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
drm-intel-fixes@lists.freedesktop.org,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [patch] drm/i915: fix a read size argument
Date: Thu, 13 Oct 2016 15:13:11 +0300 [thread overview]
Message-ID: <87zim8wip4.fsf@intel.com> (raw)
In-Reply-To: <57FF5380.1080704@bfs.de>
On Thu, 13 Oct 2016, walter harms <wharms@bfs.de> wrote:
> Am 13.10.2016 10:55, schrieb Dan Carpenter:
>> We want to read 3 bytes here, but because the parenthesis are in the
>> wrong place we instead read:
>>
>> sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)
>>
>> which is one byte.
>>
>> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Dan, good catch, thank you. Luckily we only really use the first byte
currently...
Cc: <drm-intel-fixes@lists.freedesktop.org>
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 14a3cf0..ee8aa95 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>> /* Read the eDP Display control capabilities registers */
>> if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>> drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
>> - intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) ==
>> - sizeof(intel_dp->edp_dpcd)))
>> + intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
>> + sizeof(intel_dp->edp_dpcd))
>
>
>
> perhaps we can morph that into something more readable ? I would suggest:
>
>
> if (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE)
> {
> size_t size=sizeof(intel_dp->edp_dpcd); /* == EDP_DISPLAY_CTL_CAP_SIZE */
> int ret;
>
> ret=drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,intel_dp->edp_dpcd,size);
>
> if (ret != size )
> ......
>
> }
>
> this way it improves readability and reduces line length.
Not convinced, let's just take the simple brace fix now.
BR,
Jani.
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: wharms@bfs.de, Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Daniel Vetter" <daniel.vetter@intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"David Airlie" <airlied@linux.ie>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
drm-intel-fixes@lists.freedesktop.org
Subject: Re: [patch] drm/i915: fix a read size argument
Date: Thu, 13 Oct 2016 15:13:11 +0300 [thread overview]
Message-ID: <87zim8wip4.fsf@intel.com> (raw)
In-Reply-To: <57FF5380.1080704@bfs.de>
On Thu, 13 Oct 2016, walter harms <wharms@bfs.de> wrote:
> Am 13.10.2016 10:55, schrieb Dan Carpenter:
>> We want to read 3 bytes here, but because the parenthesis are in the
>> wrong place we instead read:
>>
>> sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)
>>
>> which is one byte.
>>
>> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Dan, good catch, thank you. Luckily we only really use the first byte
currently...
Cc: <drm-intel-fixes@lists.freedesktop.org>
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 14a3cf0..ee8aa95 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>> /* Read the eDP Display control capabilities registers */
>> if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>> drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
>> - intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) ==
>> - sizeof(intel_dp->edp_dpcd)))
>> + intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
>> + sizeof(intel_dp->edp_dpcd))
>
>
>
> perhaps we can morph that into something more readable ? I would suggest:
>
>
> if (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE)
> {
> size_t size=sizeof(intel_dp->edp_dpcd); /* == EDP_DISPLAY_CTL_CAP_SIZE */
> int ret;
>
> ret=drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,intel_dp->edp_dpcd,size);
>
> if (ret != size )
> ......
>
> }
>
> this way it improves readability and reduces line length.
Not convinced, let's just take the simple brace fix now.
BR,
Jani.
--
Jani Nikula, Intel Open Source Technology Center
next prev parent reply other threads:[~2016-10-13 12:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-13 8:55 [patch] drm/i915: fix a read size argument Dan Carpenter
2016-10-13 8:55 ` Dan Carpenter
2016-10-13 8:55 ` Dan Carpenter
2016-10-13 9:01 ` [Intel-gfx] " Chris Wilson
2016-10-13 9:01 ` Chris Wilson
2016-10-13 9:01 ` Chris Wilson
2016-10-13 9:58 ` [Intel-gfx] " Dan Carpenter
2016-10-13 9:58 ` Dan Carpenter
2016-10-13 9:07 ` Eric Engestrom
2016-10-13 9:07 ` Eric Engestrom
2016-10-13 9:07 ` Eric Engestrom
2016-10-13 9:27 ` walter harms
2016-10-13 9:27 ` walter harms
2016-10-13 9:27 ` walter harms
2016-10-13 12:13 ` Jani Nikula [this message]
2016-10-13 12:13 ` Jani Nikula
2016-10-13 12:13 ` Jani Nikula
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=87zim8wip4.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=dan.carpenter@oracle.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=drm-intel-fixes@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wharms@bfs.de \
/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.