From fb28915aacfe5ae133e6b20b43ffb0708de382f1 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Fri, 23 Dec 2016 10:45:49 +0100 Subject: ata: pata-imx: simplify assignment of device name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Sascha Hauer --- drivers/ata/pata-imx.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'drivers/ata') diff --git a/drivers/ata/pata-imx.c b/drivers/ata/pata-imx.c index c8098a537f..4f75048c12 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; -- cgit v1.2.3