lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200903173843.GF8299@kadam>
Date:   Thu, 3 Sep 2020 20:38:44 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Alex Dewar <alex.dewar90@...il.com>
Cc:     devel@...verdev.osuosl.org, Alan Cox <alan@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-kernel@...r.kernel.org,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org
Subject: Re: [PATCH] staging: media: atomisp: Fix error path in lm3554_probe()

On Thu, Sep 03, 2020 at 04:48:41PM +0100, Alex Dewar wrote:
> Good point about the timer!
> 
> > >  
> > > -	err = lm3554_gpio_init(client);
> > > -	if (err) {
> > > +	ret = lm3554_gpio_init(client);
> > > +	if (ret) {
> > >  		dev_err(&client->dev, "gpio request/direction_output fail");
> > > -		goto fail2;
> > > +		goto err_cleanup_entity;
> > >  	}
> > >  	return atomisp_register_i2c_module(&flash->sd, NULL, LED_FLASH);
> > 
> > If atomisp_register_i2c_module() fails then we need to call
> > lm3554_gpio_uninit(client) and do other cleanup.
> 
> I'm probably showing my ignorance here, but I can't see what cleanup we
> need. Inside lm3554_gpio_init we have:
> 
> 	ret = gpiod_direction_output(pdata->gpio_reset, 0);
> 	if (ret < 0)
> 		return ret;
> 	dev_info(&client->dev, "flash led reset successfully\n");
> 
> 	if (!pdata->gpio_strobe)
> 		return -EINVAL;
> 
> 	ret = gpiod_direction_output(pdata->gpio_strobe, 0);
> 	if (ret < 0)
> 		return ret;
> 
> I'm not sure how you "undo" a call to gpiod_direction_output, but I'm
> thinking you won't need to do anything because it should be ok to leave
> a gpio to output 0... right?

You're right.  I wonder if there is really any need for the
lm3554_gpio_uninit() function at all?  It's basically the same as
lm3554_gpio_init() except for the order of function calls.  Probably
we could just rename lm3554_gpio_init() to something like
lm3554_gpio_set_default() and use it in both the probe() and remove
functions()...

But I don't know the code and can't test it so let's leave that for
another day.

We still do need to clean up if atomisp_register_i2c_module() fails
though, and the timer as well so could you resend a v2?

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ