From mboxrd@z Thu Jan 1 00:00:00 1970 From: Igor Grinberg Date: Mon, 15 Sep 2014 21:36:47 +0300 Subject: [U-Boot] [PATCH 06/10] dm: imx: Use gpio_request() to request GPIOs In-Reply-To: References: <1410785865-27946-1-git-send-email-sjg@chromium.org> <1410785865-27946-7-git-send-email-sjg@chromium.org> <54171E38.5050703@compulab.co.il> Message-ID: <541731BF.9070708@compulab.co.il> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 09/15/14 21:04, Simon Glass wrote: > Hi Igor, > > On 15 September 2014 11:13, Igor Grinberg wrote: >> Hi Simon, >> >> On 09/15/14 15:57, Simon Glass wrote: >>> GPIOs should be requested before use. Without this, driver model will not >>> permit the GPIO to be used. [...] >> >> In all the above gpio_request() calls, I think we should check for >> the return value. >> Because after patch 8 in the series it can fail if if someone >> double requests the same gpio. > > That's true, although for a particular board you presumably know what > you are doing. The problem happens more when we move this sort of > thing to drivers, and there is a conflict. > > In some cases there is not way to report an error (void functions), > and in others it needs additional plumbing. But I agree we should > start to fix this sort of thing. Ok. So for the board code, which is the current user of gpio_request() function, I would at least add an error message and stop trying to access the "failed to request" gpio. -- Regards, Igor.