[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200806221537.GA703560@bjorn-Precision-5520>
Date: Thu, 6 Aug 2020 17:15:37 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>,
"open list:STAGING SUBSYSTEM" <devel@...verdev.osuosl.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Cengiz Can <cengiz@...nel.wtf>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Linux Media Mailing List <linux-media@...r.kernel.org>
Subject: Re: [PATCH] staging: atomisp: move null check to earlier point
On Thu, Jul 30, 2020 at 11:45:45AM +0300, Dan Carpenter wrote:
> On Wed, Jul 29, 2020 at 06:13:44PM +0300, Andy Shevchenko wrote:
> > On Wed, Jul 29, 2020 at 5:00 PM Cengiz Can <cengiz@...nel.wtf> wrote:
> > >
> > > `find_gmin_subdev` function that returns a pointer to `struct
> > > gmin_subdev` can return NULL.
> > >
> > > In `gmin_v2p8_ctrl` there's a call to this function but the possibility
> > > of a NULL was not checked before its being dereferenced. ie:
> > >
> > > ```
> > > /* Acquired here --------v */
> > > struct gmin_subdev *gs = find_gmin_subdev(subdev);
> > > int ret;
> > > int value;
> > >
> > > /* v------Dereferenced here */
> > > if (gs->v2p8_gpio >= 0) {
> > > pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n",
> > > gs->v2p8_gpio);
> > > ret = gpio_request(gs->v2p8_gpio, "camera_v2p8");
> > > if (!ret)
> > > ret = gpio_direction_output(gs->v2p8_gpio, 0);
> > > if (ret)
> > > pr_err("V2P8 GPIO initialization failed\n");
> > > }
> > > ```
> > >
> > > I have moved the NULL check before deref point.
> >
> > "Move the NULL check..."
> > See Submitting Patches documentation how to avoid "This patch", "I", "we", etc.
>
> I always feel like this is a pointless requirement. We're turning
> into bureaucrats.
There is a danger of that, and I'm more guilty than most. But I do
think there's value in consistent style because it allows readers to
focus on the content instead of being distracted by different margins,
grammar ("move vs. moved"), paragraph styles, quoting conventions,
etc.
Ideally we would scan previous commit logs (and the existing code!)
and make new changes fit seamlessly so it looks like everything was
done at the same time by the same person.
But often that doesn't happen. Sometimes I take the liberty to tweak
things as I apply them to try to avoid trivial rework.
Bjorn
Powered by blists - more mailing lists