mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] ata: pata-imx: simplify assignment of device name
Date: Fri, 23 Dec 2016 10:45:49 +0100	[thread overview]
Message-ID: <20161223094549.3311-1-u.kleine-koenig@pengutronix.de> (raw)

If OF_DEVICE isn't enabled, of_alias_get returns NULL. Also xstrdup
returns NULL when NULL is passed as argument. This allows to simplify
accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/ata/pata-imx.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/ata/pata-imx.c b/drivers/ata/pata-imx.c
index c8098a537fe5..4f75048c12ce 100644
--- a/drivers/ata/pata-imx.c
+++ b/drivers/ata/pata-imx.c
@@ -158,7 +158,6 @@ static int imx_pata_probe(struct device_d *dev)
 	struct clk *clk;
 	void __iomem *base;
 	int ret;
-	const char *devname = NULL;
 
 	ide = xzalloc(sizeof(*ide));
 	iores = dev_request_mem_resource(dev, 0);
@@ -182,14 +181,9 @@ static int imx_pata_probe(struct device_d *dev)
 
 	pata_imx_set_bus_timing(base, clk_get_rate(clk), 4);
 
-	if (IS_ENABLED(CONFIG_OFDEVICE)) {
-		devname = of_alias_get(dev->device_node);
-		if (devname)
-			devname = xstrdup(devname);
-	}
 
 	ide->port.dev = dev;
-	ide->port.devname = devname;
+	ide->port.devname = xstrdup(of_alias_get(dev->device_node));
 
 	dev->priv = ide;
 	dev->detect = pata_imx_detect;
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2016-12-23  9:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-23  9:45 Uwe Kleine-König [this message]
2016-12-23  9:50 ` Uwe Kleine-König
2017-01-09  8:53   ` Sascha Hauer
2017-01-11 16:06     ` Uwe Kleine-König
2017-01-09  8:43 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161223094549.3311-1-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox