public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: Reduce scope of 'state' variable
@ 2017-06-15 10:41 Dawid Kurek
  2017-06-15 11:09 ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Dawid Kurek @ 2017-06-15 10:41 UTC (permalink / raw)
  To: Daniel Vetter, Jani Nikula, Sean Paul, David Airlie, dri-devel,
	linux-kernel

Smaller scope reduces visibility of variable and makes usage of
uninitialized variable less possible.
---
 drivers/gpu/drm/drm_atomic.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index f32506a..ea5a9a7 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -108,10 +108,11 @@ 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) {
-		state = kzalloc(sizeof(*state), GFP_KERNEL);
+		struct drm_atomic_state *state
+			= kzalloc(sizeof(*state), GFP_KERNEL);
+
 		if (!state)
 			return NULL;
 		if (drm_atomic_state_init(dev, state) < 0) {
-- 
2.10.0


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-15 16:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-15 10:41 [PATCH] drm: Reduce scope of 'state' variable Dawid Kurek
2017-06-15 11:09 ` Jani Nikula
2017-06-15 14:24   ` Dawid Kurek
2017-06-15 15:10     ` Jani Nikula
2017-06-15 16:56       ` Dawid Kurek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox