Re: [PATCH 2/2] stmmac: Add IMG Pistachio platform glue layer

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

 




From: Andrew Bresticker <abrestic@xxxxxxxxxxxx>
Date: Thu,  2 Apr 2015 16:46:36 -0700

> +static void *pistachio_dwmac_setup(struct platform_device *pdev)
> +{
> +	struct pistachio_dwmac_priv_data *pdata;
> +
> +	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> +	if (!pdata)
> +		return ERR_PTR(-ENOMEM);
> +
> +	pdata->sys_clk = devm_clk_get(&pdev->dev, "sys");
> +	if (IS_ERR(pdata->sys_clk)) {
> +		dev_err(&pdev->dev, "Failed to get sys clock: %ld\n",
> +			PTR_ERR(pdata->sys_clk));
> +		return pdata->sys_clk;

Please do not store potential error pointers in dynamically allocated
memory.

Put it in a local variable for the devm_clk_get() call, then if it
succeeds and is not an error pointer, place it into pdata->sys_clk.

You must resubmit this entire patch series when updating any aspect
of it.  I'm pre-emptively telling you this because often people think
they can just post a new version of the fixed patch, but that's not
how things work here :-)

Thanks.
--
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