Add an alternative to drm_encoder_init() that allocates and initializes an encoder and registers drm_encoder_cleanup() with drmm_add_action_or_reset().
Signed-off-by: Philipp Zabel p.zabel@pengutronix.de --- drivers/gpu/drm/drm_encoder.c | 104 ++++++++++++++++++++++++++-------- include/drm/drm_encoder.h | 30 ++++++++++ 2 files changed, 111 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index e555281f43d4..0f9b69d22057 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -26,6 +26,7 @@ #include <drm/drm_device.h> #include <drm/drm_drv.h> #include <drm/drm_encoder.h> +#include <drm/drm_managed.h>
#include "drm_crtc_internal.h"
@@ -91,25 +92,10 @@ void drm_encoder_unregister_all(struct drm_device *dev) } }
-/** - * drm_encoder_init - Init a preallocated encoder - * @dev: drm device - * @encoder: the encoder to init - * @funcs: callbacks for this encoder - * @encoder_type: user visible type of the encoder - * @name: printf style format string for the encoder name, or NULL for default name - * - * Initialises a preallocated encoder. Encoder should be subclassed as part of - * driver encoder objects. At driver unload time drm_encoder_cleanup() should be - * called from the driver's &drm_encoder_funcs.destroy hook. - * - * Returns: - * Zero on success, error code on failure. - */ -int drm_encoder_init(struct drm_device *dev, - struct drm_encoder *encoder, - const struct drm_encoder_funcs *funcs, - int encoder_type, const char *name, ...) +static int __drm_encoder_init(struct drm_device *dev, + struct drm_encoder *encoder, + const struct drm_encoder_funcs *funcs, + int encoder_type, const char *name, va_list ap) { int ret;
@@ -125,11 +111,7 @@ int drm_encoder_init(struct drm_device *dev, encoder->encoder_type = encoder_type; encoder->funcs = funcs; if (name) { - va_list ap; - - va_start(ap, name); encoder->name = kvasprintf(GFP_KERNEL, name, ap); - va_end(ap); } else { encoder->name = kasprintf(GFP_KERNEL, "%s-%d", drm_encoder_enum_list[encoder_type].name, @@ -150,6 +132,38 @@ int drm_encoder_init(struct drm_device *dev,
return ret; } + +/** + * drm_encoder_init - Init a preallocated encoder + * @dev: drm device + * @encoder: the encoder to init + * @funcs: callbacks for this encoder + * @encoder_type: user visible type of the encoder + * @name: printf style format string for the encoder name, or NULL for default name + * + * Initializes a preallocated encoder. Encoder should be subclassed as part of + * driver encoder objects. At driver unload time drm_encoder_cleanup() should be + * called from the driver's &drm_encoder_funcs.destroy hook. + * + * Returns: + * Zero on success, error code on failure. + */ +int drm_encoder_init(struct drm_device *dev, + struct drm_encoder *encoder, + const struct drm_encoder_funcs *funcs, + int encoder_type, const char *name, ...) +{ + va_list ap; + int ret; + + if (name) + va_start(ap, name); + ret = __drm_encoder_init(dev, encoder, funcs, encoder_type, name, ap); + if (name) + va_end(ap); + + return ret; +} EXPORT_SYMBOL(drm_encoder_init);
/** @@ -181,6 +195,50 @@ void drm_encoder_cleanup(struct drm_encoder *encoder) } EXPORT_SYMBOL(drm_encoder_cleanup);
+static void drmm_encoder_alloc_release(struct drm_device *dev, void *ptr) +{ + struct drm_encoder *encoder = ptr; + + if (WARN_ON(!encoder->dev)) + return; + + drm_encoder_cleanup(encoder); +} + +void *__drmm_encoder_alloc(struct drm_device *dev, size_t size, size_t offset, + const struct drm_encoder_funcs *funcs, + int encoder_type, const char *name, ...) +{ + void *container; + struct drm_encoder *encoder; + va_list ap; + int ret; + + if (WARN_ON(!funcs || funcs->destroy)) + return ERR_PTR(-EINVAL); + + container = drmm_kzalloc(dev, size, GFP_KERNEL); + if (!container) + return ERR_PTR(-EINVAL); + + encoder = container + offset; + + if (name) + va_start(ap, name); + ret = __drm_encoder_init(dev, encoder, funcs, encoder_type, name, ap); + if (name) + va_end(ap); + if (ret) + return ERR_PTR(ret); + + ret = drmm_add_action_or_reset(dev, drmm_encoder_alloc_release, encoder); + if (ret) + return ERR_PTR(ret); + + return container; +} +EXPORT_SYMBOL(__drmm_encoder_alloc); + static struct drm_crtc *drm_encoder_get_crtc(struct drm_encoder *encoder) { struct drm_connector *connector; diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h index a60f5f1555ac..4ecad1260ff7 100644 --- a/include/drm/drm_encoder.h +++ b/include/drm/drm_encoder.h @@ -195,6 +195,36 @@ int drm_encoder_init(struct drm_device *dev, const struct drm_encoder_funcs *funcs, int encoder_type, const char *name, ...);
+__printf(6, 7) +void *__drmm_encoder_alloc(struct drm_device *dev, + size_t size, size_t offset, + const struct drm_encoder_funcs *funcs, + int encoder_type, + const char *name, ...); + +/** + * drmm_encoder_alloc - Allocate and initialize an encoder + * @dev: drm device + * @type: the type of the struct which contains struct &drm_encoder + * @member: the name of the &drm_encoder within @type. + * @funcs: callbacks for this encoder + * @encoder_type: user visible type of the encoder + * @name: printf style format string for the encoder name, or NULL for default name + * + * Allocates and initializes an encoder. Encoder should be subclassed as part of + * driver encoder objects. Cleanup is automatically handled through registering + * drm_encoder_cleanup() with drmm_add_action(). + * + * The @drm_encoder_funcs.destroy hook must be NULL. + * + * Returns: + * Pointer to new encoder, or ERR_PTR on failure. + */ +#define drmm_encoder_alloc(dev, type, member, funcs, encoder_type, name, ...) \ + ((type *)__drmm_encoder_alloc(dev, sizeof(type), \ + offsetof(type, member), funcs, \ + encoder_type, name, ##__VA_ARGS__)) + /** * drm_encoder_index - find the index of a registered encoder * @encoder: encoder to find index for
Add an alternative to drm_simple_encoder_init() that allocates and initializes a simple encoder and registers drm_encoder_cleanup() with drmm_add_action_or_reset().
Signed-off-by: Philipp Zabel p.zabel@pengutronix.de --- drivers/gpu/drm/drm_simple_kms_helper.c | 12 ++++++++++++ include/drm/drm_simple_kms_helper.h | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+)
diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index 74946690aba4..3cbbfb0f9b51 100644 --- a/drivers/gpu/drm/drm_simple_kms_helper.c +++ b/drivers/gpu/drm/drm_simple_kms_helper.c @@ -9,6 +9,7 @@ #include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_bridge.h> +#include <drm/drm_managed.h> #include <drm/drm_plane_helper.h> #include <drm/drm_probe_helper.h> #include <drm/drm_simple_kms_helper.h> @@ -71,6 +72,17 @@ int drm_simple_encoder_init(struct drm_device *dev, } EXPORT_SYMBOL(drm_simple_encoder_init);
+static const struct drm_encoder_funcs drmm_simple_encoder_funcs_empty = { }; + +void *__drmm_simple_encoder_alloc(struct drm_device *dev, size_t size, + size_t offset, int encoder_type) +{ + return __drmm_encoder_alloc(dev, size, offset, + &drmm_simple_encoder_funcs_empty, + encoder_type, NULL); +} +EXPORT_SYMBOL(__drmm_simple_encoder_alloc); + static enum drm_mode_status drm_simple_kms_crtc_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode *mode) diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h index a026375464ff..e6dbf3161c2f 100644 --- a/include/drm/drm_simple_kms_helper.h +++ b/include/drm/drm_simple_kms_helper.h @@ -185,4 +185,28 @@ int drm_simple_encoder_init(struct drm_device *dev, struct drm_encoder *encoder, int encoder_type);
+void *__drmm_simple_encoder_alloc(struct drm_device *dev, size_t size, + size_t offset, int encoder_type); + +/** + * drmm_simple_encoder_alloc - Allocate and initialize an encoder with basic + * functionality. + * @dev: drm device + * @type: the type of the struct which contains struct &drm_encoder + * @member: the name of the &drm_encoder within @type. + * @encoder_type: user visible type of the encoder + * + * Allocates and initializes an encoder that has no further functionality. + * Settings for possible CRTC and clones are left to their initial values. + * Cleanup is automatically handled through registering drm_encoder_cleanup() + * with drmm_add_action(). + * + * Returns: + * Pointer to new encoder, or ERR_PTR on failure. + */ +#define drmm_simple_encoder_alloc(dev, type, member, encoder_type) \ + ((type *)__drmm_simple_encoder_alloc(dev, sizeof(type), \ + offsetof(type, member), \ + encoder_type)) + #endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */
Add an alternative to drm_universal_plane_init() that allocates and initializes a plane and registers drm_plane_cleanup() with drmm_add_action_or_reset().
Signed-off-by: Philipp Zabel p.zabel@pengutronix.de --- drivers/gpu/drm/drm_plane.c | 127 ++++++++++++++++++++++++++++-------- include/drm/drm_plane.h | 42 ++++++++++++ 2 files changed, 140 insertions(+), 29 deletions(-)
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index b7b90b3a2e38..0a565d97650c 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -30,6 +30,7 @@ #include <drm/drm_file.h> #include <drm/drm_crtc.h> #include <drm/drm_fourcc.h> +#include <drm/drm_managed.h> #include <drm/drm_vblank.h>
#include "drm_crtc_internal.h" @@ -152,31 +153,13 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane return 0; }
-/** - * drm_universal_plane_init - Initialize a new universal plane object - * @dev: DRM device - * @plane: plane object to init - * @possible_crtcs: bitmask of possible CRTCs - * @funcs: callbacks for the new plane - * @formats: array of supported formats (DRM_FORMAT_*) - * @format_count: number of elements in @formats - * @format_modifiers: array of struct drm_format modifiers terminated by - * DRM_FORMAT_MOD_INVALID - * @type: type of plane (overlay, primary, cursor) - * @name: printf style format string for the plane name, or NULL for default name - * - * Initializes a plane object of type @type. - * - * Returns: - * Zero on success, error code on failure. - */ -int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, - uint32_t possible_crtcs, - const struct drm_plane_funcs *funcs, - const uint32_t *formats, unsigned int format_count, - const uint64_t *format_modifiers, - enum drm_plane_type type, - const char *name, ...) +int __drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, + uint32_t possible_crtcs, + const struct drm_plane_funcs *funcs, + const uint32_t *formats, unsigned int format_count, + const uint64_t *format_modifiers, + enum drm_plane_type type, + const char *name, va_list ap) { struct drm_mode_config *config = &dev->mode_config; unsigned int format_modifier_count = 0; @@ -237,11 +220,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, }
if (name) { - va_list ap; - - va_start(ap, name); plane->name = kvasprintf(GFP_KERNEL, name, ap); - va_end(ap); } else { plane->name = kasprintf(GFP_KERNEL, "plane-%d", drm_num_planes(dev)); @@ -286,8 +265,98 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
return 0; } + +/** + * drm_universal_plane_init - Initialize a new universal plane object + * @dev: DRM device + * @plane: plane object to init + * @possible_crtcs: bitmask of possible CRTCs + * @funcs: callbacks for the new plane + * @formats: array of supported formats (DRM_FORMAT_*) + * @format_count: number of elements in @formats + * @format_modifiers: array of struct drm_format modifiers terminated by + * DRM_FORMAT_MOD_INVALID + * @type: type of plane (overlay, primary, cursor) + * @name: printf style format string for the plane name, or NULL for default name + * + * Initializes a plane object of type @type. + * + * Returns: + * Zero on success, error code on failure. + */ +int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, + uint32_t possible_crtcs, + const struct drm_plane_funcs *funcs, + const uint32_t *formats, unsigned int format_count, + const uint64_t *format_modifiers, + enum drm_plane_type type, + const char *name, ...) +{ + va_list ap; + int ret; + + if (name) + va_start(ap, name); + ret = __drm_universal_plane_init(dev, plane, possible_crtcs, funcs, + formats, format_count, format_modifiers, + type, name, ap); + if (name) + va_end(ap); + return ret; +} EXPORT_SYMBOL(drm_universal_plane_init);
+static void drmm_universal_plane_alloc_release(struct drm_device *dev, void *ptr) +{ + struct drm_plane *plane = ptr; + + if (WARN_ON(!plane->dev)) + return; + + drm_plane_cleanup(plane); +} + +void *__drmm_universal_plane_alloc(struct drm_device *dev, size_t size, + size_t offset, uint32_t possible_crtcs, + const struct drm_plane_funcs *funcs, + const uint32_t *formats, unsigned int format_count, + const uint64_t *format_modifiers, + enum drm_plane_type type, + const char *name, ...) +{ + void *container; + struct drm_plane *plane; + va_list ap; + int ret; + + if (!funcs || funcs->destroy) + return ERR_PTR(-EINVAL); + + container = drmm_kzalloc(dev, size, GFP_KERNEL); + if (!container) + return ERR_PTR(-ENOMEM); + + plane = container + offset; + + if (name) + va_start(ap, name); + ret = __drm_universal_plane_init(dev, plane, possible_crtcs, funcs, + formats, format_count, format_modifiers, + type, name, ap); + if (name) + va_end(ap); + if (ret) + return ERR_PTR(ret); + + ret = drmm_add_action_or_reset(dev, drmm_universal_plane_alloc_release, + plane); + if (ret) + return ERR_PTR(ret); + + return container; +} +EXPORT_SYMBOL(__drmm_universal_plane_alloc); + int drm_plane_register_all(struct drm_device *dev) { unsigned int num_planes = 0; diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 3f396d94afe4..82bd63710a39 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -746,6 +746,48 @@ int drm_plane_init(struct drm_device *dev, bool is_primary); void drm_plane_cleanup(struct drm_plane *plane);
+__printf(10, 11) +void *__drmm_universal_plane_alloc(struct drm_device *dev, + size_t size, size_t offset, + uint32_t possible_crtcs, + const struct drm_plane_funcs *funcs, + const uint32_t *formats, + unsigned int format_count, + const uint64_t *format_modifiers, + enum drm_plane_type plane_type, + const char *name, ...); + +/** + * drmm_universal_plane_alloc - Allocate and initialize an universal plane object + * @dev: DRM device + * @type: the type of the struct which contains struct &drm_plane + * @member: the name of the &drm_plane within @type + * @possible_crtcs: bitmask of possible CRTCs + * @funcs: callbacks for the new plane + * @formats: array of supported formats (DRM_FORMAT_*) + * @format_count: number of elements in @formats + * @format_modifiers: array of struct drm_format modifiers terminated by + * DRM_FORMAT_MOD_INVALID + * @plane_type: type of plane (overlay, primary, cursor) + * @name: printf style format string for the plane name, or NULL for default name + * + * Allocates and initializes a plane object of type @type. Cleanup is + * automatically handled through registering drm_plane_cleanup() with + * drmm_add_action(). + * + * The @drm_plane_funcs.destroy hook must be NULL. + * + * Returns: + * Pointer to new plane, or ERR_PTR on failure. + */ +#define drmm_universal_plane_alloc(dev, type, member, possible_crtcs, funcs, formats, \ + format_count, format_modifiers, plane_type, name, ...) \ + ((type *)__drmm_universal_plane_alloc(dev, sizeof(type), \ + offsetof(type, member), \ + possible_crtcs, funcs, formats, \ + format_count, format_modifiers, \ + plane_type, name, ##__VA_ARGS__)) + /** * drm_plane_index - find the index of a registered plane * @plane: plane to find index for
Hi Philipp,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next] [also build test WARNING on tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master drm-exynos/exynos-drm-next v5.9-rc2 next-20200826] [cannot apply to drm/drm-next] [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/Philipp-Zabel/drm-add-drmm_encoder_... base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-s001-20200826 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.2-191-g10164920-dirty # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com
sparse warnings: (new ones prefixed by >>)
drivers/gpu/drm/drm_plane.c:156:5: sparse: sparse: symbol '__drm_universal_plane_init' was not declared. Should it be static?
Please review and possibly fold the followup patch.
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Signed-off-by: kernel test robot lkp@intel.com --- drm_plane.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 0a565d97650cb..0f1d8589ab6c7 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -153,13 +153,13 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane return 0; }
-int __drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, - uint32_t possible_crtcs, - const struct drm_plane_funcs *funcs, - const uint32_t *formats, unsigned int format_count, - const uint64_t *format_modifiers, - enum drm_plane_type type, - const char *name, va_list ap) +static int __drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, + uint32_t possible_crtcs, + const struct drm_plane_funcs *funcs, + const uint32_t *formats, unsigned int format_count, + const uint64_t *format_modifiers, + enum drm_plane_type type, + const char *name, va_list ap) { struct drm_mode_config *config = &dev->mode_config; unsigned int format_modifier_count = 0;
Hi Philipp,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next] [also build test WARNING on tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master drm-exynos/exynos-drm-next v5.9-rc2 next-20200826] [cannot apply to drm/drm-next] [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/Philipp-Zabel/drm-add-drmm_encoder_... base: git://anongit.freedesktop.org/drm-intel for-linux-next config: arm-randconfig-r001-20200826 (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com
All warnings (new ones prefixed by >>):
drivers/gpu/drm/drm_plane.c:156:5: warning: no previous prototype for '__drm_universal_plane_init' [-Wmissing-prototypes]
156 | int __drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/drm_plane.c: In function '__drm_universal_plane_init':
drivers/gpu/drm/drm_plane.c:223:3: warning: function '__drm_universal_plane_init' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
223 | plane->name = kvasprintf(GFP_KERNEL, name, ap); | ^~~~~
# https://github.com/0day-ci/linux/commit/d809a51da3d2939a84ecf6b4ada8f5be6c3e... git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Philipp-Zabel/drm-add-drmm_encoder_alloc/20200826-203629 git checkout d809a51da3d2939a84ecf6b4ada8f5be6c3ecb35 vim +/__drm_universal_plane_init +156 drivers/gpu/drm/drm_plane.c
155
156 int __drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
157 uint32_t possible_crtcs, 158 const struct drm_plane_funcs *funcs, 159 const uint32_t *formats, unsigned int format_count, 160 const uint64_t *format_modifiers, 161 enum drm_plane_type type, 162 const char *name, va_list ap) 163 { 164 struct drm_mode_config *config = &dev->mode_config; 165 unsigned int format_modifier_count = 0; 166 int ret; 167 168 /* plane index is used with 32bit bitmasks */ 169 if (WARN_ON(config->num_total_plane >= 32)) 170 return -EINVAL; 171 172 WARN_ON(drm_drv_uses_atomic_modeset(dev) && 173 (!funcs->atomic_destroy_state || 174 !funcs->atomic_duplicate_state)); 175 176 ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); 177 if (ret) 178 return ret; 179 180 drm_modeset_lock_init(&plane->mutex); 181 182 plane->base.properties = &plane->properties; 183 plane->dev = dev; 184 plane->funcs = funcs; 185 plane->format_types = kmalloc_array(format_count, sizeof(uint32_t), 186 GFP_KERNEL); 187 if (!plane->format_types) { 188 DRM_DEBUG_KMS("out of memory when allocating plane\n"); 189 drm_mode_object_unregister(dev, &plane->base); 190 return -ENOMEM; 191 } 192 193 /* 194 * First driver to need more than 64 formats needs to fix this. Each 195 * format is encoded as a bit and the current code only supports a u64. 196 */ 197 if (WARN_ON(format_count > 64)) 198 return -EINVAL; 199 200 if (format_modifiers) { 201 const uint64_t *temp_modifiers = format_modifiers; 202 203 while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID) 204 format_modifier_count++; 205 } 206 207 if (format_modifier_count) 208 config->allow_fb_modifiers = true; 209 210 plane->modifier_count = format_modifier_count; 211 plane->modifiers = kmalloc_array(format_modifier_count, 212 sizeof(format_modifiers[0]), 213 GFP_KERNEL); 214 215 if (format_modifier_count && !plane->modifiers) { 216 DRM_DEBUG_KMS("out of memory when allocating plane\n"); 217 kfree(plane->format_types); 218 drm_mode_object_unregister(dev, &plane->base); 219 return -ENOMEM; 220 } 221 222 if (name) {
223 plane->name = kvasprintf(GFP_KERNEL, name, ap);
224 } else { 225 plane->name = kasprintf(GFP_KERNEL, "plane-%d", 226 drm_num_planes(dev)); 227 } 228 if (!plane->name) { 229 kfree(plane->format_types); 230 kfree(plane->modifiers); 231 drm_mode_object_unregister(dev, &plane->base); 232 return -ENOMEM; 233 } 234 235 memcpy(plane->format_types, formats, format_count * sizeof(uint32_t)); 236 plane->format_count = format_count; 237 memcpy(plane->modifiers, format_modifiers, 238 format_modifier_count * sizeof(format_modifiers[0])); 239 plane->possible_crtcs = possible_crtcs; 240 plane->type = type; 241 242 list_add_tail(&plane->head, &config->plane_list); 243 plane->index = config->num_total_plane++; 244 245 drm_object_attach_property(&plane->base, 246 config->plane_type_property, 247 plane->type); 248 249 if (drm_core_check_feature(dev, DRIVER_ATOMIC)) { 250 drm_object_attach_property(&plane->base, config->prop_fb_id, 0); 251 drm_object_attach_property(&plane->base, config->prop_in_fence_fd, -1); 252 drm_object_attach_property(&plane->base, config->prop_crtc_id, 0); 253 drm_object_attach_property(&plane->base, config->prop_crtc_x, 0); 254 drm_object_attach_property(&plane->base, config->prop_crtc_y, 0); 255 drm_object_attach_property(&plane->base, config->prop_crtc_w, 0); 256 drm_object_attach_property(&plane->base, config->prop_crtc_h, 0); 257 drm_object_attach_property(&plane->base, config->prop_src_x, 0); 258 drm_object_attach_property(&plane->base, config->prop_src_y, 0); 259 drm_object_attach_property(&plane->base, config->prop_src_w, 0); 260 drm_object_attach_property(&plane->base, config->prop_src_h, 0); 261 } 262 263 if (config->allow_fb_modifiers) 264 create_in_format_blob(dev, plane); 265 266 return 0; 267 } 268
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Philipp,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next] [also build test WARNING on tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master drm-exynos/exynos-drm-next v5.9-rc2 next-20200826] [cannot apply to drm/drm-next] [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/Philipp-Zabel/drm-add-drmm_encoder_... base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-randconfig-a003-20200826 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 7cfcecece0e0430937cf529ce74d3a071a4dedc6) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com
All warnings (new ones prefixed by >>):
drivers/gpu/drm/drm_plane.c:156:5: warning: no previous prototype for function '__drm_universal_plane_init' [-Wmissing-prototypes]
int __drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, ^ drivers/gpu/drm/drm_plane.c:156:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, ^ static 1 warning generated.
# https://github.com/0day-ci/linux/commit/d809a51da3d2939a84ecf6b4ada8f5be6c3e... git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Philipp-Zabel/drm-add-drmm_encoder_alloc/20200826-203629 git checkout d809a51da3d2939a84ecf6b4ada8f5be6c3ecb35 vim +/__drm_universal_plane_init +156 drivers/gpu/drm/drm_plane.c
155
156 int __drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
157 uint32_t possible_crtcs, 158 const struct drm_plane_funcs *funcs, 159 const uint32_t *formats, unsigned int format_count, 160 const uint64_t *format_modifiers, 161 enum drm_plane_type type, 162 const char *name, va_list ap) 163 { 164 struct drm_mode_config *config = &dev->mode_config; 165 unsigned int format_modifier_count = 0; 166 int ret; 167 168 /* plane index is used with 32bit bitmasks */ 169 if (WARN_ON(config->num_total_plane >= 32)) 170 return -EINVAL; 171 172 WARN_ON(drm_drv_uses_atomic_modeset(dev) && 173 (!funcs->atomic_destroy_state || 174 !funcs->atomic_duplicate_state)); 175 176 ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); 177 if (ret) 178 return ret; 179 180 drm_modeset_lock_init(&plane->mutex); 181 182 plane->base.properties = &plane->properties; 183 plane->dev = dev; 184 plane->funcs = funcs; 185 plane->format_types = kmalloc_array(format_count, sizeof(uint32_t), 186 GFP_KERNEL); 187 if (!plane->format_types) { 188 DRM_DEBUG_KMS("out of memory when allocating plane\n"); 189 drm_mode_object_unregister(dev, &plane->base); 190 return -ENOMEM; 191 } 192 193 /* 194 * First driver to need more than 64 formats needs to fix this. Each 195 * format is encoded as a bit and the current code only supports a u64. 196 */ 197 if (WARN_ON(format_count > 64)) 198 return -EINVAL; 199 200 if (format_modifiers) { 201 const uint64_t *temp_modifiers = format_modifiers; 202 203 while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID) 204 format_modifier_count++; 205 } 206 207 if (format_modifier_count) 208 config->allow_fb_modifiers = true; 209 210 plane->modifier_count = format_modifier_count; 211 plane->modifiers = kmalloc_array(format_modifier_count, 212 sizeof(format_modifiers[0]), 213 GFP_KERNEL); 214 215 if (format_modifier_count && !plane->modifiers) { 216 DRM_DEBUG_KMS("out of memory when allocating plane\n"); 217 kfree(plane->format_types); 218 drm_mode_object_unregister(dev, &plane->base); 219 return -ENOMEM; 220 } 221 222 if (name) { 223 plane->name = kvasprintf(GFP_KERNEL, name, ap); 224 } else { 225 plane->name = kasprintf(GFP_KERNEL, "plane-%d", 226 drm_num_planes(dev)); 227 } 228 if (!plane->name) { 229 kfree(plane->format_types); 230 kfree(plane->modifiers); 231 drm_mode_object_unregister(dev, &plane->base); 232 return -ENOMEM; 233 } 234 235 memcpy(plane->format_types, formats, format_count * sizeof(uint32_t)); 236 plane->format_count = format_count; 237 memcpy(plane->modifiers, format_modifiers, 238 format_modifier_count * sizeof(format_modifiers[0])); 239 plane->possible_crtcs = possible_crtcs; 240 plane->type = type; 241 242 list_add_tail(&plane->head, &config->plane_list); 243 plane->index = config->num_total_plane++; 244 245 drm_object_attach_property(&plane->base, 246 config->plane_type_property, 247 plane->type); 248 249 if (drm_core_check_feature(dev, DRIVER_ATOMIC)) { 250 drm_object_attach_property(&plane->base, config->prop_fb_id, 0); 251 drm_object_attach_property(&plane->base, config->prop_in_fence_fd, -1); 252 drm_object_attach_property(&plane->base, config->prop_crtc_id, 0); 253 drm_object_attach_property(&plane->base, config->prop_crtc_x, 0); 254 drm_object_attach_property(&plane->base, config->prop_crtc_y, 0); 255 drm_object_attach_property(&plane->base, config->prop_crtc_w, 0); 256 drm_object_attach_property(&plane->base, config->prop_crtc_h, 0); 257 drm_object_attach_property(&plane->base, config->prop_src_x, 0); 258 drm_object_attach_property(&plane->base, config->prop_src_y, 0); 259 drm_object_attach_property(&plane->base, config->prop_src_w, 0); 260 drm_object_attach_property(&plane->base, config->prop_src_h, 0); 261 } 262 263 if (config->allow_fb_modifiers) 264 create_in_format_blob(dev, plane); 265 266 return 0; 267 } 268
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Philipp,
url: https://github.com/0day-ci/linux/commits/Philipp-Zabel/drm-add-drmm_encoder_... base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-randconfig-m001-20200826 (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 Reported-by: Dan Carpenter dan.carpenter@oracle.com
New smatch warnings: drivers/gpu/drm/drm_plane.c:302 drm_universal_plane_init() error: uninitialized symbol 'ap'. drivers/gpu/drm/drm_plane.c:345 __drmm_universal_plane_alloc() error: uninitialized symbol 'ap'.
Old smatch warnings: drivers/gpu/drm/drm_plane.c:117 create_in_format_blob() error: potential null dereference 'blob'. (drm_property_create_blob returns null)
# https://github.com/0day-ci/linux/commit/d809a51da3d2939a84ecf6b4ada8f5be6c3e... git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Philipp-Zabel/drm-add-drmm_encoder_alloc/20200826-203629 git checkout d809a51da3d2939a84ecf6b4ada8f5be6c3ecb35 vim +/ap +302 drivers/gpu/drm/drm_plane.c
d809a51da3d293 Philipp Zabel 2020-08-26 287 int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, d809a51da3d293 Philipp Zabel 2020-08-26 288 uint32_t possible_crtcs, d809a51da3d293 Philipp Zabel 2020-08-26 289 const struct drm_plane_funcs *funcs, d809a51da3d293 Philipp Zabel 2020-08-26 290 const uint32_t *formats, unsigned int format_count, d809a51da3d293 Philipp Zabel 2020-08-26 291 const uint64_t *format_modifiers, d809a51da3d293 Philipp Zabel 2020-08-26 292 enum drm_plane_type type, d809a51da3d293 Philipp Zabel 2020-08-26 293 const char *name, ...) d809a51da3d293 Philipp Zabel 2020-08-26 294 { d809a51da3d293 Philipp Zabel 2020-08-26 295 va_list ap; ^^^^^^^^^^ d809a51da3d293 Philipp Zabel 2020-08-26 296 int ret; d809a51da3d293 Philipp Zabel 2020-08-26 297 d809a51da3d293 Philipp Zabel 2020-08-26 298 if (name) d809a51da3d293 Philipp Zabel 2020-08-26 299 va_start(ap, name); ^^
d809a51da3d293 Philipp Zabel 2020-08-26 300 ret = __drm_universal_plane_init(dev, plane, possible_crtcs, funcs, d809a51da3d293 Philipp Zabel 2020-08-26 301 formats, format_count, format_modifiers, d809a51da3d293 Philipp Zabel 2020-08-26 @302 type, name, ap); ^^ This isn't always initialized. Presumably it's not a problem but runtime tools like KASan (syzbot) will detect the load and complain as well so it's probably better to silence it.
d809a51da3d293 Philipp Zabel 2020-08-26 303 if (name) d809a51da3d293 Philipp Zabel 2020-08-26 304 va_end(ap); d809a51da3d293 Philipp Zabel 2020-08-26 305 return ret; d809a51da3d293 Philipp Zabel 2020-08-26 306 } 43968d7b806d7a Daniel Vetter 2016-09-21 307 EXPORT_SYMBOL(drm_universal_plane_init); 43968d7b806d7a Daniel Vetter 2016-09-21 308 d809a51da3d293 Philipp Zabel 2020-08-26 309 static void drmm_universal_plane_alloc_release(struct drm_device *dev, void *ptr) d809a51da3d293 Philipp Zabel 2020-08-26 310 { d809a51da3d293 Philipp Zabel 2020-08-26 311 struct drm_plane *plane = ptr; d809a51da3d293 Philipp Zabel 2020-08-26 312 d809a51da3d293 Philipp Zabel 2020-08-26 313 if (WARN_ON(!plane->dev)) d809a51da3d293 Philipp Zabel 2020-08-26 314 return; d809a51da3d293 Philipp Zabel 2020-08-26 315 d809a51da3d293 Philipp Zabel 2020-08-26 316 drm_plane_cleanup(plane); d809a51da3d293 Philipp Zabel 2020-08-26 317 } d809a51da3d293 Philipp Zabel 2020-08-26 318 d809a51da3d293 Philipp Zabel 2020-08-26 319 void *__drmm_universal_plane_alloc(struct drm_device *dev, size_t size, d809a51da3d293 Philipp Zabel 2020-08-26 320 size_t offset, uint32_t possible_crtcs, d809a51da3d293 Philipp Zabel 2020-08-26 321 const struct drm_plane_funcs *funcs, d809a51da3d293 Philipp Zabel 2020-08-26 322 const uint32_t *formats, unsigned int format_count, d809a51da3d293 Philipp Zabel 2020-08-26 323 const uint64_t *format_modifiers, d809a51da3d293 Philipp Zabel 2020-08-26 324 enum drm_plane_type type, d809a51da3d293 Philipp Zabel 2020-08-26 325 const char *name, ...) d809a51da3d293 Philipp Zabel 2020-08-26 326 { d809a51da3d293 Philipp Zabel 2020-08-26 327 void *container; d809a51da3d293 Philipp Zabel 2020-08-26 328 struct drm_plane *plane; d809a51da3d293 Philipp Zabel 2020-08-26 329 va_list ap; d809a51da3d293 Philipp Zabel 2020-08-26 330 int ret; d809a51da3d293 Philipp Zabel 2020-08-26 331 d809a51da3d293 Philipp Zabel 2020-08-26 332 if (!funcs || funcs->destroy) d809a51da3d293 Philipp Zabel 2020-08-26 333 return ERR_PTR(-EINVAL); d809a51da3d293 Philipp Zabel 2020-08-26 334 d809a51da3d293 Philipp Zabel 2020-08-26 335 container = drmm_kzalloc(dev, size, GFP_KERNEL); d809a51da3d293 Philipp Zabel 2020-08-26 336 if (!container) d809a51da3d293 Philipp Zabel 2020-08-26 337 return ERR_PTR(-ENOMEM); d809a51da3d293 Philipp Zabel 2020-08-26 338 d809a51da3d293 Philipp Zabel 2020-08-26 339 plane = container + offset; d809a51da3d293 Philipp Zabel 2020-08-26 340 d809a51da3d293 Philipp Zabel 2020-08-26 341 if (name) d809a51da3d293 Philipp Zabel 2020-08-26 342 va_start(ap, name); d809a51da3d293 Philipp Zabel 2020-08-26 343 ret = __drm_universal_plane_init(dev, plane, possible_crtcs, funcs, d809a51da3d293 Philipp Zabel 2020-08-26 344 formats, format_count, format_modifiers, d809a51da3d293 Philipp Zabel 2020-08-26 @345 type, name, ap); d809a51da3d293 Philipp Zabel 2020-08-26 346 if (name) d809a51da3d293 Philipp Zabel 2020-08-26 347 va_end(ap); d809a51da3d293 Philipp Zabel 2020-08-26 348 if (ret) d809a51da3d293 Philipp Zabel 2020-08-26 349 return ERR_PTR(ret); d809a51da3d293 Philipp Zabel 2020-08-26 350 d809a51da3d293 Philipp Zabel 2020-08-26 351 ret = drmm_add_action_or_reset(dev, drmm_universal_plane_alloc_release, d809a51da3d293 Philipp Zabel 2020-08-26 352 plane); d809a51da3d293 Philipp Zabel 2020-08-26 353 if (ret) d809a51da3d293 Philipp Zabel 2020-08-26 354 return ERR_PTR(ret); d809a51da3d293 Philipp Zabel 2020-08-26 355 d809a51da3d293 Philipp Zabel 2020-08-26 356 return container; d809a51da3d293 Philipp Zabel 2020-08-26 357 }
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Add an alternative to drm_crtc_init_with_planes() that allocates and initializes a crtc and registers drm_crtc_cleanup() with drmm_add_action_or_reset().
Signed-off-by: Philipp Zabel p.zabel@pengutronix.de --- drivers/gpu/drm/drm_crtc.c | 119 ++++++++++++++++++++++++++++--------- include/drm/drm_crtc.h | 33 ++++++++++ 2 files changed, 124 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 283bcc4362ca..a31dcfa6b579 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -38,6 +38,7 @@ #include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include <drm/drm_fourcc.h> +#include <drm/drm_managed.h> #include <drm/drm_modeset_lock.h> #include <drm/drm_atomic.h> #include <drm/drm_auth.h> @@ -231,30 +232,11 @@ struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc) * Setting MODE_ID to 0 will release reserved resources for the CRTC. */
-/** - * drm_crtc_init_with_planes - Initialise a new CRTC object with - * specified primary and cursor planes. - * @dev: DRM device - * @crtc: CRTC object to init - * @primary: Primary plane for CRTC - * @cursor: Cursor plane for CRTC - * @funcs: callbacks for the new CRTC - * @name: printf style format string for the CRTC name, or NULL for default name - * - * Inits a new object created as base part of a driver crtc object. Drivers - * should use this function instead of drm_crtc_init(), which is only provided - * for backwards compatibility with drivers which do not yet support universal - * planes). For really simple hardware which has only 1 plane look at - * drm_simple_display_pipe_init() instead. - * - * Returns: - * Zero on success, error code on failure. - */ -int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, - struct drm_plane *primary, - struct drm_plane *cursor, - const struct drm_crtc_funcs *funcs, - const char *name, ...) +static int __drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, + struct drm_plane *primary, + struct drm_plane *cursor, + const struct drm_crtc_funcs *funcs, + const char *name, va_list ap) { struct drm_mode_config *config = &dev->mode_config; int ret; @@ -282,11 +264,7 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, return ret;
if (name) { - va_list ap; - - va_start(ap, name); crtc->name = kvasprintf(GFP_KERNEL, name, ap); - va_end(ap); } else { crtc->name = kasprintf(GFP_KERNEL, "crtc-%d", drm_num_crtcs(dev)); @@ -330,8 +308,93 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
return 0; } + +/** + * drm_crtc_init_with_planes - Initialise a new CRTC object with + * specified primary and cursor planes. + * @dev: DRM device + * @crtc: CRTC object to init + * @primary: Primary plane for CRTC + * @cursor: Cursor plane for CRTC + * @funcs: callbacks for the new CRTC + * @name: printf style format string for the CRTC name, or NULL for default name + * + * Inits a new object created as base part of a driver crtc object. Drivers + * should use this function instead of drm_crtc_init(), which is only provided + * for backwards compatibility with drivers which do not yet support universal + * planes). For really simple hardware which has only 1 plane look at + * drm_simple_display_pipe_init() instead. + * + * Returns: + * Zero on success, error code on failure. + */ +int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, + struct drm_plane *primary, + struct drm_plane *cursor, + const struct drm_crtc_funcs *funcs, + const char *name, ...) +{ + va_list ap; + int ret; + + if (name) + va_start(ap, name); + ret = drm_crtc_init_with_planes(dev, crtc, primary, cursor, funcs, + name, ap); + if (name) + va_end(ap); + + return ret; +} EXPORT_SYMBOL(drm_crtc_init_with_planes);
+static void drmm_crtc_alloc_with_planes_cleanup(struct drm_device *dev, + void *ptr) +{ + struct drm_crtc *crtc = ptr; + + drm_crtc_cleanup(crtc); +} + +void *__drmm_crtc_alloc_with_planes(struct drm_device *dev, + size_t size, size_t offset, + struct drm_plane *primary, + struct drm_plane *cursor, + const struct drm_crtc_funcs *funcs, + const char *name, ...) +{ + void *container; + struct drm_crtc *crtc; + va_list ap; + int ret; + + if (!funcs || funcs->destroy) + return ERR_PTR(-EINVAL); + + container = drmm_kzalloc(dev, size, GFP_KERNEL); + if (!container) + return ERR_PTR(-ENOMEM); + + crtc = container + offset; + + if (name) + va_start(ap, name); + ret = __drm_crtc_init_with_planes(dev, crtc, primary, cursor, funcs, + name, ap); + if (name) + va_end(ap); + if (ret) + return ERR_PTR(ret); + + ret = drmm_add_action_or_reset(dev, drmm_crtc_alloc_with_planes_cleanup, + crtc); + if (ret) + return ERR_PTR(ret); + + return container; +} +EXPORT_SYMBOL(__drmm_crtc_alloc_with_planes); + /** * drm_crtc_cleanup - Clean up the core crtc usage * @crtc: CRTC to cleanup diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 59b51a09cae6..b71c0a3d4126 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1210,6 +1210,39 @@ int drm_crtc_init_with_planes(struct drm_device *dev, const char *name, ...); void drm_crtc_cleanup(struct drm_crtc *crtc);
+__printf(7, 8) +void *__drmm_crtc_alloc_with_planes(struct drm_device *dev, + size_t size, size_t offset, + struct drm_plane *primary, + struct drm_plane *cursor, + const struct drm_crtc_funcs *funcs, + const char *name, ...); + +/** + * drm_crtc_alloc_with_planes - Allocate and initialize a new CRTC object with + * specified primary and cursor planes. + * @dev: DRM device + * @type: the type of the struct which contains struct &drm_crtc + * @member: the name of the &drm_crtc within @type. + * @primary: Primary plane for CRTC + * @cursor: Cursor plane for CRTC + * @funcs: callbacks for the new CRTC + * @name: printf style format string for the CRTC name, or NULL for default name + * + * Allocates and initializes a new crtc object. Cleanup is automatically + * handled through registering drmm_crtc_cleanup() with drmm_add_action(). + * + * The @drm_crtc_funcs.destroy hook must be NULL. + * + * Returns: + * Pointer to new crtc, or ERR_PTR on failure. + */ +#define drmm_crtc_alloc_with_planes(dev, type, member, primary, cursor, funcs, name, ...) \ + ((type *)__drmm_crtc_alloc_with_planes(dev, sizeof(type), \ + offsetof(type, member), \ + primary, cursor, funcs, \ + name, ##__VA_ARGS__)) + /** * drm_crtc_index - find the index of a registered CRTC * @crtc: CRTC to find index for
Hi Philipp,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next] [also build test WARNING on drm-tip/drm-tip linus/master v5.9-rc2 next-20200826] [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next] [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/Philipp-Zabel/drm-add-drmm_encoder_... base: git://anongit.freedesktop.org/drm-intel for-linux-next config: arm-randconfig-r001-20200826 (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com
All warnings (new ones prefixed by >>):
drivers/gpu/drm/drm_crtc.c: In function '__drm_crtc_init_with_planes':
drivers/gpu/drm/drm_crtc.c:267:3: warning: function '__drm_crtc_init_with_planes' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
267 | crtc->name = kvasprintf(GFP_KERNEL, name, ap); | ^~~~
# https://github.com/0day-ci/linux/commit/236b7bc44ae0fdecc8e80c5aba0655ca14fd... git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Philipp-Zabel/drm-add-drmm_encoder_alloc/20200826-203629 git checkout 236b7bc44ae0fdecc8e80c5aba0655ca14fdfb23 vim +267 drivers/gpu/drm/drm_crtc.c
35f8cc3b9a92c66 Gustavo Padovan 2016-12-06 207 e954f77f6330028 Simon Ser 2020-05-21 208 /** e954f77f6330028 Simon Ser 2020-05-21 209 * DOC: standard CRTC properties e954f77f6330028 Simon Ser 2020-05-21 210 * e954f77f6330028 Simon Ser 2020-05-21 211 * DRM CRTCs have a few standardized properties: e954f77f6330028 Simon Ser 2020-05-21 212 * e954f77f6330028 Simon Ser 2020-05-21 213 * ACTIVE: e954f77f6330028 Simon Ser 2020-05-21 214 * Atomic property for setting the power state of the CRTC. When set to 1 e954f77f6330028 Simon Ser 2020-05-21 215 * the CRTC will actively display content. When set to 0 the CRTC will be e954f77f6330028 Simon Ser 2020-05-21 216 * powered off. There is no expectation that user-space will reset CRTC e954f77f6330028 Simon Ser 2020-05-21 217 * resources like the mode and planes when setting ACTIVE to 0. e954f77f6330028 Simon Ser 2020-05-21 218 * e954f77f6330028 Simon Ser 2020-05-21 219 * User-space can rely on an ACTIVE change to 1 to never fail an atomic e954f77f6330028 Simon Ser 2020-05-21 220 * test as long as no other property has changed. If a change to ACTIVE e954f77f6330028 Simon Ser 2020-05-21 221 * fails an atomic test, this is a driver bug. For this reason setting e954f77f6330028 Simon Ser 2020-05-21 222 * ACTIVE to 0 must not release internal resources (like reserved memory e954f77f6330028 Simon Ser 2020-05-21 223 * bandwidth or clock generators). e954f77f6330028 Simon Ser 2020-05-21 224 * e954f77f6330028 Simon Ser 2020-05-21 225 * Note that the legacy DPMS property on connectors is internally routed e954f77f6330028 Simon Ser 2020-05-21 226 * to control this property for atomic drivers. e954f77f6330028 Simon Ser 2020-05-21 227 * MODE_ID: e954f77f6330028 Simon Ser 2020-05-21 228 * Atomic property for setting the CRTC display timings. The value is the e954f77f6330028 Simon Ser 2020-05-21 229 * ID of a blob containing the DRM mode info. To disable the CRTC, e954f77f6330028 Simon Ser 2020-05-21 230 * user-space must set this property to 0. e954f77f6330028 Simon Ser 2020-05-21 231 * e954f77f6330028 Simon Ser 2020-05-21 232 * Setting MODE_ID to 0 will release reserved resources for the CRTC. e954f77f6330028 Simon Ser 2020-05-21 233 */ e954f77f6330028 Simon Ser 2020-05-21 234 236b7bc44ae0fde Philipp Zabel 2020-08-26 235 static int __drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, e13161af80c185e Matt Roper 2014-04-01 236 struct drm_plane *primary, fc1d3e44ef7c1db Matt Roper 2014-06-10 237 struct drm_plane *cursor, f98828769c8838f Ville Syrjälä 2015-12-09 238 const struct drm_crtc_funcs *funcs, 236b7bc44ae0fde Philipp Zabel 2020-08-26 239 const char *name, va_list ap) f453ba0460742ad Dave Airlie 2008-11-07 240 { 51fd371bbaf9401 Rob Clark 2013-11-19 241 struct drm_mode_config *config = &dev->mode_config; 6bfc56aa89f963b Ville Syrjälä 2012-03-13 242 int ret; 6bfc56aa89f963b Ville Syrjälä 2012-03-13 243 522cf91f30cb010 Benjamin Gaignard 2015-03-17 244 WARN_ON(primary && primary->type != DRM_PLANE_TYPE_PRIMARY); 522cf91f30cb010 Benjamin Gaignard 2015-03-17 245 WARN_ON(cursor && cursor->type != DRM_PLANE_TYPE_CURSOR); 522cf91f30cb010 Benjamin Gaignard 2015-03-17 246 2a8d3eac3d6e116 Ville Syrjälä 2018-01-25 247 /* crtc index is used with 32bit bitmasks */ 2a8d3eac3d6e116 Ville Syrjälä 2018-01-25 248 if (WARN_ON(config->num_crtc >= 32)) 2a8d3eac3d6e116 Ville Syrjälä 2018-01-25 249 return -EINVAL; 2a8d3eac3d6e116 Ville Syrjälä 2018-01-25 250 ba1f665f161ce11 Haneen Mohammed 2018-05-25 251 WARN_ON(drm_drv_uses_atomic_modeset(dev) && ba1f665f161ce11 Haneen Mohammed 2018-05-25 252 (!funcs->atomic_destroy_state || ba1f665f161ce11 Haneen Mohammed 2018-05-25 253 !funcs->atomic_duplicate_state)); ba1f665f161ce11 Haneen Mohammed 2018-05-25 254 f453ba0460742ad Dave Airlie 2008-11-07 255 crtc->dev = dev; f453ba0460742ad Dave Airlie 2008-11-07 256 crtc->funcs = funcs; f453ba0460742ad Dave Airlie 2008-11-07 257 3b24f7d67581659 Daniel Vetter 2016-06-08 258 INIT_LIST_HEAD(&crtc->commit_list); 3b24f7d67581659 Daniel Vetter 2016-06-08 259 spin_lock_init(&crtc->commit_lock); 3b24f7d67581659 Daniel Vetter 2016-06-08 260 51fd371bbaf9401 Rob Clark 2013-11-19 261 drm_modeset_lock_init(&crtc->mutex); 2135ea7aafa26b6 Thierry Reding 2017-02-28 262 ret = drm_mode_object_add(dev, &crtc->base, DRM_MODE_OBJECT_CRTC); 6bfc56aa89f963b Ville Syrjälä 2012-03-13 263 if (ret) baf698b0496e93f Daniel Vetter 2014-11-12 264 return ret; f453ba0460742ad Dave Airlie 2008-11-07 265 fa3ab4c2113c74a Ville Syrjälä 2015-12-08 266 if (name) { fa3ab4c2113c74a Ville Syrjälä 2015-12-08 @267 crtc->name = kvasprintf(GFP_KERNEL, name, ap); fa3ab4c2113c74a Ville Syrjälä 2015-12-08 268 } else { fa3ab4c2113c74a Ville Syrjälä 2015-12-08 269 crtc->name = kasprintf(GFP_KERNEL, "crtc-%d", fa3ab4c2113c74a Ville Syrjälä 2015-12-08 270 drm_num_crtcs(dev)); fa3ab4c2113c74a Ville Syrjälä 2015-12-08 271 } fa3ab4c2113c74a Ville Syrjälä 2015-12-08 272 if (!crtc->name) { 7c8f6d2577c7565 Dave Airlie 2016-04-15 273 drm_mode_object_unregister(dev, &crtc->base); fa3ab4c2113c74a Ville Syrjälä 2015-12-08 274 return -ENOMEM; fa3ab4c2113c74a Ville Syrjälä 2015-12-08 275 } fa3ab4c2113c74a Ville Syrjälä 2015-12-08 276 6d6003c4b613c93 Gustavo Padovan 2016-11-15 277 crtc->fence_context = dma_fence_context_alloc(1); 6d6003c4b613c93 Gustavo Padovan 2016-11-15 278 spin_lock_init(&crtc->fence_lock); 6d6003c4b613c93 Gustavo Padovan 2016-11-15 279 snprintf(crtc->timeline_name, sizeof(crtc->timeline_name), 6d6003c4b613c93 Gustavo Padovan 2016-11-15 280 "CRTC:%d-%s", crtc->base.id, crtc->name); 6d6003c4b613c93 Gustavo Padovan 2016-11-15 281 bffd9de02977025 Paulo Zanoni 2012-05-15 282 crtc->base.properties = &crtc->properties; bffd9de02977025 Paulo Zanoni 2012-05-15 283 51fd371bbaf9401 Rob Clark 2013-11-19 284 list_add_tail(&crtc->head, &config->crtc_list); 490d3d1b91201fd Chris Wilson 2016-05-27 285 crtc->index = config->num_crtc++; 6bfc56aa89f963b Ville Syrjälä 2012-03-13 286 e13161af80c185e Matt Roper 2014-04-01 287 crtc->primary = primary; fc1d3e44ef7c1db Matt Roper 2014-06-10 288 crtc->cursor = cursor; 7abc7d47510c75d Rob Clark 2016-11-05 289 if (primary && !primary->possible_crtcs) 6a52193bd0dd683 Ville Syrjälä 2018-06-26 290 primary->possible_crtcs = drm_crtc_mask(crtc); 7abc7d47510c75d Rob Clark 2016-11-05 291 if (cursor && !cursor->possible_crtcs) 6a52193bd0dd683 Ville Syrjälä 2018-06-26 292 cursor->possible_crtcs = drm_crtc_mask(crtc); e13161af80c185e Matt Roper 2014-04-01 293 9edbf1fa600a2ef Tomeu Vizoso 2016-10-06 294 ret = drm_crtc_crc_init(crtc); 9edbf1fa600a2ef Tomeu Vizoso 2016-10-06 295 if (ret) { 9edbf1fa600a2ef Tomeu Vizoso 2016-10-06 296 drm_mode_object_unregister(dev, &crtc->base); 9edbf1fa600a2ef Tomeu Vizoso 2016-10-06 297 return ret; 9edbf1fa600a2ef Tomeu Vizoso 2016-10-06 298 } 9edbf1fa600a2ef Tomeu Vizoso 2016-10-06 299 eab3bbeffd15212 Daniel Vetter 2015-01-22 300 if (drm_core_check_feature(dev, DRIVER_ATOMIC)) { eab3bbeffd15212 Daniel Vetter 2015-01-22 301 drm_object_attach_property(&crtc->base, config->prop_active, 0); 955f3c334f0fb2b Daniel Stone 2015-05-25 302 drm_object_attach_property(&crtc->base, config->prop_mode_id, 0); beaf5af48034c9e Gustavo Padovan 2016-11-16 303 drm_object_attach_property(&crtc->base, beaf5af48034c9e Gustavo Padovan 2016-11-16 304 config->prop_out_fence_ptr, 0); 1398958cfd8d331 Nicholas Kazlauskas 2018-10-04 305 drm_object_attach_property(&crtc->base, 1398958cfd8d331 Nicholas Kazlauskas 2018-10-04 306 config->prop_vrr_enabled, 0); eab3bbeffd15212 Daniel Vetter 2015-01-22 307 } eab3bbeffd15212 Daniel Vetter 2015-01-22 308 baf698b0496e93f Daniel Vetter 2014-11-12 309 return 0; f453ba0460742ad Dave Airlie 2008-11-07 310 } 236b7bc44ae0fde Philipp Zabel 2020-08-26 311
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Philipp,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next] [also build test WARNING on drm-tip/drm-tip linus/master v5.9-rc2 next-20200826] [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next] [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/Philipp-Zabel/drm-add-drmm_encoder_... base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-randconfig-a003-20200826 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 7cfcecece0e0430937cf529ce74d3a071a4dedc6) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com
All warnings (new ones prefixed by >>):
drivers/gpu/drm/drm_crtc.c:336:1: warning: all paths through this function will call itself [-Winfinite-recursion]
{ ^ 1 warning generated.
# https://github.com/0day-ci/linux/commit/236b7bc44ae0fdecc8e80c5aba0655ca14fd... git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Philipp-Zabel/drm-add-drmm_encoder_alloc/20200826-203629 git checkout 236b7bc44ae0fdecc8e80c5aba0655ca14fdfb23 vim +336 drivers/gpu/drm/drm_crtc.c
311 312 /** 313 * drm_crtc_init_with_planes - Initialise a new CRTC object with 314 * specified primary and cursor planes. 315 * @dev: DRM device 316 * @crtc: CRTC object to init 317 * @primary: Primary plane for CRTC 318 * @cursor: Cursor plane for CRTC 319 * @funcs: callbacks for the new CRTC 320 * @name: printf style format string for the CRTC name, or NULL for default name 321 * 322 * Inits a new object created as base part of a driver crtc object. Drivers 323 * should use this function instead of drm_crtc_init(), which is only provided 324 * for backwards compatibility with drivers which do not yet support universal 325 * planes). For really simple hardware which has only 1 plane look at 326 * drm_simple_display_pipe_init() instead. 327 * 328 * Returns: 329 * Zero on success, error code on failure. 330 */ 331 int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, 332 struct drm_plane *primary, 333 struct drm_plane *cursor, 334 const struct drm_crtc_funcs *funcs, 335 const char *name, ...)
336 {
337 va_list ap; 338 int ret; 339 340 if (name) 341 va_start(ap, name); 342 ret = drm_crtc_init_with_planes(dev, crtc, primary, cursor, funcs, 343 name, ap); 344 if (name) 345 va_end(ap); 346 347 return ret; 348 } 349 EXPORT_SYMBOL(drm_crtc_init_with_planes); 350
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Greeting,
FYI, we noticed the following commit (built with gcc-9):
commit: 236b7bc44ae0fdecc8e80c5aba0655ca14fdfb23 ("[PATCH 4/4] drm/crtc: add drmm_crtc_alloc_with_planes()") url: https://github.com/0day-ci/linux/commits/Philipp-Zabel/drm-add-drmm_encoder_... base: git://anongit.freedesktop.org/drm-intel for-linux-next
in testcase: trinity with following parameters:
runtime: 300s
test-description: Trinity is a linux system call fuzz tester. test-url: http://codemonkey.org.uk/projects/trinity/
on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 8G
caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
+---------------------------------------------------------------------------------------------+------------+------------+ | | d809a51da3 | 236b7bc44a | +---------------------------------------------------------------------------------------------+------------+------------+ | boot_successes | 16 | 0 | | boot_failures | 0 | 4 | | BUG:stack_guard_page_was_hit_at(____ptrval____)(stack_is(____ptrval____)..(____ptrval____)) | 0 | 4 | | RIP:drm_crtc_init_with_planes[drm] | 0 | 4 | | Kernel_panic-not_syncing:Fatal_exception_in_interrupt | 0 | 4 | +---------------------------------------------------------------------------------------------+------------+------------+
If you fix the issue, kindly add following tag Reported-by: kernel test robot lkp@intel.com
[ 12.795894] BUG: stack guard page was hit at (____ptrval____) (stack is (____ptrval____)..(____ptrval____)) [ 12.795895] kernel stack overflow (double-fault): 0000 [#1] SMP PTI [ 12.795896] CPU: 0 PID: 193 Comm: systemd-udevd Not tainted 5.8.0-01890-g236b7bc44ae0fd #1 [ 12.795897] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 [ 12.795898] RIP: 0010:drm_crtc_init_with_planes+0x5/0x80 [drm] [ 12.795899] Code: 0f eb 16 48 8b 50 10 48 8d 42 f0 48 39 d7 74 09 39 b0 90 00 00 00 75 eb c3 31 c0 c3 66 0f 1f 84 00 00 00 00 00 66 66 66 66 90 <55> 48 89 e5 41 52 4c 8d 55 10 48 83 ec 50 65 48 8b 04 25 28 00 00 [ 12.795900] RSP: 0018:ffffac1040344000 EFLAGS: 00010246 [ 12.795902] RAX: ffffac1040344010 RBX: ffff9b400fa8b078 RCX: 0000000000000000 [ 12.795902] RDX: ffff9b400fa8b490 RSI: ffff9b400fa8b078 RDI: ffff9b4010c5c000 [ 12.795903] RBP: ffffac1040344068 R08: ffffffffc04d3340 R09: 0000000000000000 [ 12.795904] R10: ffffac1040344078 R11: 0000000000000000 R12: ffff9b4010c5c000 [ 12.795905] R13: ffff9b400fa8b490 R14: 000000000000000a R15: ffffffffc0621300 [ 12.795905] FS: 00007faf7e56dd40(0000) GS:ffff9b403fc00000(0000) knlGS:0000000000000000 [ 12.795906] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 12.795907] CR2: ffffac1040343ff8 CR3: 0000000168096000 CR4: 00000000000406f0 [ 12.795907] Call Trace: [ 12.795908] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795909] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795910] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795911] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795912] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795913] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795914] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795915] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795916] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795917] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795918] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795919] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795920] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795921] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795922] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795923] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795924] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795925] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795926] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795927] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795928] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795929] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795930] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795931] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795932] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795933] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795934] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795935] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795936] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795937] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795938] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795939] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795940] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795941] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795942] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795943] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795944] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795945] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795946] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795947] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795948] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795949] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795950] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795951] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795952] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795953] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795954] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795955] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795956] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795957] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795958] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795959] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795960] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795961] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795962] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795963] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795964] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795965] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795966] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795967] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795968] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795969] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795970] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795971] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795972] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795973] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795974] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795975] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795976] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795977] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795978] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795979] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795980] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795981] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795982] ? update_group_capacity+0x25/0x1c0 [ 12.795982] ? cpumask_next_and+0x1a/0x20 [ 12.795983] ? update_sd_lb_stats+0x121/0x860 [ 12.795984] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795985] ? update_load_avg+0x78/0x660 [ 12.795986] ? account_entity_enqueue+0x9c/0xe0 [ 12.795986] ? enqueue_entity+0x218/0x3a0 [ 12.795987] drm_crtc_init_with_planes+0x63/0x80 [drm] [ 12.795987] ? enqueue_task_fair+0x8e/0x6a0 [ 12.795988] ? check_preempt_wakeup+0x17f/0x240 [ 12.795988] drm_crtc_init_with_planes+0x63/0x80 [drm]
To reproduce:
# build kernel cd linux cp config-5.8.0-01890-g236b7bc44ae0fd .config make HOSTCC=gcc-9 CC=gcc-9 ARCH=x86_64 olddefconfig prepare modules_prepare bzImage
git clone https://github.com/intel/lkp-tests.git cd lkp-tests bin/lkp qemu -k <bzImage> job-script # job-script is attached in this email
Thanks, lkp
Hi Philipp,
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Philipp-Zabel/drm-add-drmm_encoder_... base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-randconfig-m001-20200826 (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 Reported-by: Dan Carpenter dan.carpenter@oracle.com
smatch warnings: drivers/gpu/drm/drm_crtc.c:343 drm_crtc_init_with_planes() error: uninitialized symbol 'ap'. drivers/gpu/drm/drm_crtc.c:383 __drmm_crtc_alloc_with_planes() error: uninitialized symbol 'ap'.
# https://github.com/0day-ci/linux/commit/236b7bc44ae0fdecc8e80c5aba0655ca14fd... git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Philipp-Zabel/drm-add-drmm_encoder_alloc/20200826-203629 git checkout 236b7bc44ae0fdecc8e80c5aba0655ca14fdfb23 vim +/ap +343 drivers/gpu/drm/drm_crtc.c
236b7bc44ae0fd Philipp Zabel 2020-08-26 331 int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, 236b7bc44ae0fd Philipp Zabel 2020-08-26 332 struct drm_plane *primary, 236b7bc44ae0fd Philipp Zabel 2020-08-26 333 struct drm_plane *cursor, 236b7bc44ae0fd Philipp Zabel 2020-08-26 334 const struct drm_crtc_funcs *funcs, 236b7bc44ae0fd Philipp Zabel 2020-08-26 335 const char *name, ...) 236b7bc44ae0fd Philipp Zabel 2020-08-26 336 { 236b7bc44ae0fd Philipp Zabel 2020-08-26 337 va_list ap; 236b7bc44ae0fd Philipp Zabel 2020-08-26 338 int ret; 236b7bc44ae0fd Philipp Zabel 2020-08-26 339 236b7bc44ae0fd Philipp Zabel 2020-08-26 340 if (name) 236b7bc44ae0fd Philipp Zabel 2020-08-26 341 va_start(ap, name); 236b7bc44ae0fd Philipp Zabel 2020-08-26 342 ret = drm_crtc_init_with_planes(dev, crtc, primary, cursor, funcs, 236b7bc44ae0fd Philipp Zabel 2020-08-26 @343 name, ap); ^^
236b7bc44ae0fd Philipp Zabel 2020-08-26 344 if (name) 236b7bc44ae0fd Philipp Zabel 2020-08-26 345 va_end(ap); 236b7bc44ae0fd Philipp Zabel 2020-08-26 346 236b7bc44ae0fd Philipp Zabel 2020-08-26 347 return ret; 236b7bc44ae0fd Philipp Zabel 2020-08-26 348 } e13161af80c185 Matt Roper 2014-04-01 349 EXPORT_SYMBOL(drm_crtc_init_with_planes); f453ba0460742a Dave Airlie 2008-11-07 350 236b7bc44ae0fd Philipp Zabel 2020-08-26 351 static void drmm_crtc_alloc_with_planes_cleanup(struct drm_device *dev, 236b7bc44ae0fd Philipp Zabel 2020-08-26 352 void *ptr) 236b7bc44ae0fd Philipp Zabel 2020-08-26 353 { 236b7bc44ae0fd Philipp Zabel 2020-08-26 354 struct drm_crtc *crtc = ptr; 236b7bc44ae0fd Philipp Zabel 2020-08-26 355 236b7bc44ae0fd Philipp Zabel 2020-08-26 356 drm_crtc_cleanup(crtc); 236b7bc44ae0fd Philipp Zabel 2020-08-26 357 } 236b7bc44ae0fd Philipp Zabel 2020-08-26 358 236b7bc44ae0fd Philipp Zabel 2020-08-26 359 void *__drmm_crtc_alloc_with_planes(struct drm_device *dev, 236b7bc44ae0fd Philipp Zabel 2020-08-26 360 size_t size, size_t offset, 236b7bc44ae0fd Philipp Zabel 2020-08-26 361 struct drm_plane *primary, 236b7bc44ae0fd Philipp Zabel 2020-08-26 362 struct drm_plane *cursor, 236b7bc44ae0fd Philipp Zabel 2020-08-26 363 const struct drm_crtc_funcs *funcs, 236b7bc44ae0fd Philipp Zabel 2020-08-26 364 const char *name, ...) 236b7bc44ae0fd Philipp Zabel 2020-08-26 365 { 236b7bc44ae0fd Philipp Zabel 2020-08-26 366 void *container; 236b7bc44ae0fd Philipp Zabel 2020-08-26 367 struct drm_crtc *crtc; 236b7bc44ae0fd Philipp Zabel 2020-08-26 368 va_list ap; 236b7bc44ae0fd Philipp Zabel 2020-08-26 369 int ret; 236b7bc44ae0fd Philipp Zabel 2020-08-26 370 236b7bc44ae0fd Philipp Zabel 2020-08-26 371 if (!funcs || funcs->destroy) 236b7bc44ae0fd Philipp Zabel 2020-08-26 372 return ERR_PTR(-EINVAL); 236b7bc44ae0fd Philipp Zabel 2020-08-26 373 236b7bc44ae0fd Philipp Zabel 2020-08-26 374 container = drmm_kzalloc(dev, size, GFP_KERNEL); 236b7bc44ae0fd Philipp Zabel 2020-08-26 375 if (!container) 236b7bc44ae0fd Philipp Zabel 2020-08-26 376 return ERR_PTR(-ENOMEM); 236b7bc44ae0fd Philipp Zabel 2020-08-26 377 236b7bc44ae0fd Philipp Zabel 2020-08-26 378 crtc = container + offset; 236b7bc44ae0fd Philipp Zabel 2020-08-26 379 236b7bc44ae0fd Philipp Zabel 2020-08-26 380 if (name) 236b7bc44ae0fd Philipp Zabel 2020-08-26 381 va_start(ap, name); 236b7bc44ae0fd Philipp Zabel 2020-08-26 382 ret = __drm_crtc_init_with_planes(dev, crtc, primary, cursor, funcs, 236b7bc44ae0fd Philipp Zabel 2020-08-26 @383 name, ap); 236b7bc44ae0fd Philipp Zabel 2020-08-26 384 if (name) 236b7bc44ae0fd Philipp Zabel 2020-08-26 385 va_end(ap); 236b7bc44ae0fd Philipp Zabel 2020-08-26 386 if (ret) 236b7bc44ae0fd Philipp Zabel 2020-08-26 387 return ERR_PTR(ret); 236b7bc44ae0fd Philipp Zabel 2020-08-26 388 236b7bc44ae0fd Philipp Zabel 2020-08-26 389 ret = drmm_add_action_or_reset(dev, drmm_crtc_alloc_with_planes_cleanup, 236b7bc44ae0fd Philipp Zabel 2020-08-26 390 crtc); 236b7bc44ae0fd Philipp Zabel 2020-08-26 391 if (ret) 236b7bc44ae0fd Philipp Zabel 2020-08-26 392 return ERR_PTR(ret); 236b7bc44ae0fd Philipp Zabel 2020-08-26 393 236b7bc44ae0fd Philipp Zabel 2020-08-26 394 return container; 236b7bc44ae0fd Philipp Zabel 2020-08-26 395 }
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
dri-devel@lists.freedesktop.org