Re: [PATCH 3/4] misc: ti-st: don't use NULL pdata

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

 




On Sat, Apr 25, 2015 at 03:15:17PM -0700, Eric Nelson wrote:
> Signed-off-by: Eric Nelson <eric.nelson@xxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/misc/ti-st/st_kim.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
> index c5a0e15..4b44345 100644
> --- a/drivers/misc/ti-st/st_kim.c
> +++ b/drivers/misc/ti-st/st_kim.c
> @@ -755,8 +755,10 @@ static struct ti_st_plat_data *get_platform_data(struct device *dev)
>  
>  	dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL);
>  
> -	if (!dt_pdata)
> +	if (!dt_pdata) {
>  		pr_err("Can't allocate device_tree platform data\n");
> +		return 0;

		return NULL;

Zero means success.  You can delete the error message if you want.
That's just a waste of memory.  1) It's never going to be printed.
2)  If this particular allocation failed then we would be able to tell
exactly what failed from the stack dump and from the message in the
caller function.

> +	}

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux