Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1666751

[PATCH v2] drm: Reduce scope of 'state' variable

From Dawid Kurek <dawikur@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v2] drm: Reduce scope of 'state' variable
Date 2017-06-15 16:10 +0200
Message-ID <tSDDc-3sa-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Smaller scope reduces visibility of variable and makes usage of
uninitialized variable less possible.

Changes in v2:
	- separate declaration and initialization
---
 drivers/gpu/drm/drm_atomic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index f32506a..5e0d1e1 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -108,9 +108,10 @@ struct drm_atomic_state *
 drm_atomic_state_alloc(struct drm_device *dev)
 {
 	struct drm_mode_config *config = &dev->mode_config;
-	struct drm_atomic_state *state;
 
 	if (!config->funcs->atomic_state_alloc) {
+		struct drm_atomic_state *state;
+
 		state = kzalloc(sizeof(*state), GFP_KERNEL);
 		if (!state)
 			return NULL;
-- 
2.10.0


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v2] drm: Reduce scope of 'state' variable Dawid Kurek <dawikur@gmail.com> - 2017-06-15 16:10 +0200
  Re: [PATCH v2] drm: Reduce scope of 'state' variable Sean Paul <seanpaul@chromium.org> - 2017-06-15 19:40 +0200
    Re: [PATCH v2] drm: Reduce scope of 'state' variable Dawid Kurek <dawikur@gmail.com> - 2017-06-15 19:50 +0200

csiph-web