[Intel-gfx] [PATCH 2/2] drm/i915: Add Backlight Control using DPCD for eDP connectors (v5)

Jani Nikula jani.nikula at intel.com
Tue Jan 12 09:30:08 PST 2016


On Tue, 12 Jan 2016, Daniel Stone <daniel at fooishbar.org> wrote:
> On 12 January 2016 at 17:18, Jani Nikula <jani.nikula at intel.com> wrote:
>> On Tue, 12 Jan 2016, Daniel Stone <daniel at fooishbar.org> wrote:
>>> On 12 January 2016 at 15:59, Yetunde Adebisi <yetundex.adebisi at intel.com> wrote:
>>>> +               memset(intel_dp->edp_dpcd, 0, sizeof(intel_dp->edp_dpcd));
>>>
>>> gcc should've warned you about this; you're memsetting too small a size.
>>
>> Really? I think it's fine.
>
> foo.c:11:23: warning: argument to ‘sizeof’ in ‘memset’ call is the
> same expression as the destination; did you mean to dereference it?
> [-Wsizeof-pointer-memaccess]
>   memset(bar, 0, sizeof(bar));
>                        ^
>
> Either it should be memset(&intel_dp->edp_dpcd, ...), or it should be
> sizeof(*intel_dp->edp_dpcd). Unless the intention is genuinely just to
> clear the size of one pointer and not the entire structure, in which
> case this is terribly misleading.

It's defined as

 +	uint8_t edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];

so sizeof(intel_dp->edp_dpcd) will be EDP_DISPLAY_CTL_CAP_SIZE.

BR,
Jani.


>
> Cheers,
> Daniel

-- 
Jani Nikula, Intel Open Source Technology Center


More information about the Intel-gfx mailing list