From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758054Ab1LNUb6 (ORCPT ); Wed, 14 Dec 2011 15:31:58 -0500 Received: from metis.ext.pengutronix.de ([92.198.50.35]:46075 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755364Ab1LNUb4 (ORCPT ); Wed, 14 Dec 2011 15:31:56 -0500 Date: Wed, 14 Dec 2011 21:31:53 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: linux-kernel@vger.kernel.org Cc: kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, Shawn Guo , Alan Cox , Grant Likely , Jeremy Kerr , Jason Liu , Sascha Hauer Subject: Re: [PATCH] serial/imx: propagate error from of_alias_get_id instead of using -ENODEV Message-ID: <20111214203153.GB24496@pengutronix.de> References: <1323894411-12294-1-git-send-email-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1323894411-12294-1-git-send-email-u.kleine-koenig@pengutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:6f8:1178:2:21e:67ff:fe11:9c5c X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Wed, Dec 14, 2011 at 09:26:51PM +0100, Uwe Kleine-König wrote: > A quick look at of_alias_get_id shows that in the error case it returns > -ENODEV, too, but still it's better style to propagate the value as is. > > Signed-off-by: Uwe Kleine-König > Cc: Shawn Guo > Cc: Alan Cox > Cc: Grant Likely > Cc: Jeremy Kerr > Cc: Jason Liu > Cc: Sascha Hauer > --- > drivers/tty/serial/imx.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 163fc90..75c159a 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -1301,7 +1301,7 @@ static int serial_imx_probe_dt(struct imx_port *sport, > ret = of_alias_get_id(np, "serial"); > if (ret < 0) { > dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret); > - return -ENODEV; > + return ret; > } > sport->port.line = ret; > One more comment on serial_imx_probe_dt: It is used as follows: ret = serial_imx_probe_dt(sport, pdev); if (ret == -ENODEV) serial_imx_probe_pdata(sport, pdev); IMHO you should distinguish here more carefully between the different -ENODEV cases. It's OK to call serial_imx_probe_pdata() if !pdev->dev.of_node but if of_alias_get_id(np, "serial") returns an error isn't that something that should make the probing of the device fail instead of relying on platform data and the device id that are non-existant and more or less random respectively if the device is instantiated by dt? Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |