Re: [PATCH] ata: pata-imx: simplify assignment of device name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 23, 2016 at 10:45:49AM +0100, Uwe Kleine-König wrote:
> 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@xxxxxxxxxxxxxx>
> ---

Applied, thanks

Sascha

>  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@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux