[PATCH] drm: Reduce scope of 'state' variable
Dawid Kurek
dawikur at gmail.com
Thu Jun 15 16:56:51 UTC 2017
On 15/06/17, Jani Nikula wrote:
> On Thu, 15 Jun 2017, Dawid Kurek <dawikur at gmail.com> wrote:
> > On 15/06/17, Jani Nikula wrote:
> >> Separate declaration and initialization would lead to a cleaner patch
> >> and result.
> >
> > I saw combining declaration and initialization is quite common, i.e. in
> > drm_atomic file. Personally, I also prefer those in one statement. But yes, it
> > looks cleaner here, in two lines.
>
> I'd say the rule of thumb is that combined declaration and
> initialization is fine if the initialization is trivial, in particular
> can never fail. If you need to check the return value, like in this
> case, I'd prefer separate initialization.
>
Yeah, makes sense. If you need to check then it exceeds simple initialization,
and then it is not declare&initialize. Yes, now I see it.
Thanks a lot,
Dawid
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
More information about the dri-devel
mailing list