From: kernel test robot <lkp@intel.com>
To: "Tomi Valkeinen" <tomi.valkeinen@ti.com>,
dri-devel@lists.freedesktop.org,
"Daniel Vetter" <daniel@ffwll.ch>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>
Cc: Paul Cercueil <paul@crapouillou.net>,
kbuild-all@lists.01.org, David Airlie <airlied@linux.ie>,
Sandy Huang <hjc@rock-chips.com>,
Philippe Cornu <philippe.cornu@st.com>,
Yannick Fertre <yannick.fertre@st.com>,
Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH v2 2/2] drm: automatic legacy gamma support
Date: Fri, 11 Dec 2020 02:06:21 +0800 [thread overview]
Message-ID: <202012110104.ZPkkhoVT-lkp@intel.com> (raw)
In-Reply-To: <20201208135759.451772-3-tomi.valkeinen@ti.com>
[-- Attachment #1: Type: text/plain, Size: 4308 bytes --]
Hi Tomi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on linus/master v5.10-rc7]
[cannot apply to drm-tip/drm-tip anholt/for-next next-20201210]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/drm-fix-and-cleanup-legacy-gamma-support/20201208-215917
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-m021-20201209 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
New smatch warnings:
drivers/gpu/drm/drm_color_mgmt.c:307 drm_crtc_legacy_gamma_set() error: potential null dereference 'blob'. (drm_property_create_blob returns null)
Old smatch warnings:
drivers/gpu/drm/drm_color_mgmt.c:214 drm_mode_crtc_set_gamma_size() warn: double check that we're allocating correct size: 2 vs 6
vim +/blob +307 drivers/gpu/drm/drm_color_mgmt.c
253
254 /**
255 * drm_crtc_legacy_gamma_set - set the legacy gamma correction table
256 * @crtc: CRTC object
257 * @red: red correction table
258 * @green: green correction table
259 * @blue: green correction table
260 * @size: size of the tables
261 * @ctx: lock acquire context
262 *
263 * Implements support for legacy gamma correction table for drivers
264 * that have set drm_crtc_funcs.gamma_set or that support color management
265 * through the DEGAMMA_LUT/GAMMA_LUT properties. See
266 * drm_crtc_enable_color_mgmt() and the containing chapter for
267 * how the atomic color management and gamma tables work.
268 *
269 * This function sets the gamma using the first one available:
270 * - drm_crtc_funcs.gamma_set()
271 * - GAMMA_LUT
272 * - DEGAMMA_LUT
273 */
274 int drm_crtc_legacy_gamma_set(struct drm_crtc *crtc,
275 u16 *red, u16 *green, u16 *blue,
276 uint32_t size,
277 struct drm_modeset_acquire_ctx *ctx)
278 {
279 struct drm_device *dev = crtc->dev;
280 struct drm_atomic_state *state;
281 struct drm_crtc_state *crtc_state;
282 struct drm_property_blob *blob = NULL;
283 struct drm_color_lut *blob_data;
284 int i, ret = 0;
285 bool replaced;
286
287 if (crtc->funcs->gamma_set)
288 return crtc->funcs->gamma_set(crtc, red, green, blue, size, ctx);
289
290 if (!crtc->has_gamma_prop && !crtc->has_degamma_prop)
291 return -ENODEV;
292
293 state = drm_atomic_state_alloc(crtc->dev);
294 if (!state)
295 return -ENOMEM;
296
297 blob = drm_property_create_blob(dev,
298 sizeof(struct drm_color_lut) * size,
299 NULL);
300 if (IS_ERR(blob)) {
301 ret = PTR_ERR(blob);
302 blob = NULL;
303 goto fail;
304 }
305
306 /* Prepare GAMMA_LUT with the legacy values. */
> 307 blob_data = blob->data;
308 for (i = 0; i < size; i++) {
309 blob_data[i].red = red[i];
310 blob_data[i].green = green[i];
311 blob_data[i].blue = blue[i];
312 }
313
314 state->acquire_ctx = ctx;
315 crtc_state = drm_atomic_get_crtc_state(state, crtc);
316 if (IS_ERR(crtc_state)) {
317 ret = PTR_ERR(crtc_state);
318 goto fail;
319 }
320
321 /* Set GAMMA/DEGAMMA_LUT and reset DEGAMMA/GAMMA_LUT and CTM */
322 replaced = drm_property_replace_blob(&crtc_state->degamma_lut,
323 crtc->has_gamma_prop ? NULL : blob);
324 replaced |= drm_property_replace_blob(&crtc_state->ctm, NULL);
325 replaced |= drm_property_replace_blob(&crtc_state->gamma_lut,
326 crtc->has_gamma_prop ? blob : NULL);
327 crtc_state->color_mgmt_changed |= replaced;
328
329 ret = drm_atomic_commit(state);
330
331 fail:
332 drm_atomic_state_put(state);
333 drm_property_blob_put(blob);
334 return ret;
335 }
336 EXPORT_SYMBOL(drm_crtc_legacy_gamma_set);
337
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36289 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-12-10 18:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-08 13:57 [PATCH v2 0/2] drm: fix and cleanup legacy gamma support Tomi Valkeinen
2020-12-08 13:57 ` [PATCH v2 1/2] drm: add legacy support for using degamma for gamma Tomi Valkeinen
2020-12-08 15:55 ` Laurent Pinchart
2020-12-09 0:51 ` Daniel Vetter
2020-12-09 11:17 ` Tomi Valkeinen
2020-12-09 12:39 ` Daniel Vetter
2020-12-08 13:57 ` [PATCH v2 2/2] drm: automatic legacy gamma support Tomi Valkeinen
2020-12-08 15:59 ` Laurent Pinchart
2020-12-09 5:20 ` kernel test robot
2020-12-10 18:06 ` kernel test robot [this message]
2020-12-11 11:24 ` Tomi Valkeinen
2020-12-11 14:42 ` Ville Syrjälä
2020-12-12 8:54 ` [kbuild-all] " Philip Li
2020-12-14 18:49 ` Dan Carpenter
2020-12-16 1:06 ` Philip Li
2020-12-16 7:34 ` Dan Carpenter
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=202012110104.ZPkkhoVT-lkp@intel.com \
--to=lkp@intel.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hjc@rock-chips.com \
--cc=kbuild-all@lists.01.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux@armlinux.org.uk \
--cc=paul@crapouillou.net \
--cc=philippe.cornu@st.com \
--cc=tomi.valkeinen@ti.com \
--cc=ville.syrjala@linux.intel.com \
--cc=yannick.fertre@st.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox