From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH 01/22] serial: 8250_dw: Add optional reset control support Date: Fri, 23 May 2014 10:19:47 +0200 Message-ID: <8689536.mXHvcWVbGA@wuerfel> References: <1400831485-28576-1-git-send-email-wens@csie.org> <1400831485-28576-2-git-send-email-wens@csie.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: In-Reply-To: <1400831485-28576-2-git-send-email-wens@csie.org> Sender: linux-serial-owner@vger.kernel.org To: linux-arm-kernel@lists.infradead.org Cc: Chen-Yu Tsai , Greg Kroah-Hartman , Samuel Ortiz , Lee Jones , Maxime Ripard , Rob Herring , Mike Turquette , Emilio Lopez , Linus Walleij , devicetree@vger.kernel.org, Boris BREZILLON , Luc Verhaegen , linux-kernel@vger.kernel.org, Hans de Goede , linux-serial@vger.kernel.org List-Id: devicetree@vger.kernel.org On Friday 23 May 2014 15:51:04 Chen-Yu Tsai wrote: > p->regshift = val; > > + data->rst = devm_reset_control_get_optional(p->dev, NULL); > + > /* clock got configured through clk api, all done */ > if (p->uartclk) > return 0; > @@ -362,6 +366,9 @@ static int dw8250_probe(struct platform_device *pdev) > return -ENODEV; > } > > + if (!IS_ERR_OR_NULL(data->rst)) > + reset_control_deassert(data->rst); > + You should basically never use IS_ERR_OR_NULL(). devm_reset_control_get_optional() doesn't return NULL, so IS_ERR() should be safe. Alternatively, change the code above to set data->rst to NULL if there is no reset line or error out if you get a different error (e.g. EPROBE_DEFER). Arnd