Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1240204

Re: [PATCH v2 5/5] net: dsa: exit probe if no switch were found

From Neil Armstrong <narmstrong@baylibre.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 5/5] net: dsa: exit probe if no switch were found
Date 2015-10-06 09:30 +0200
Message-ID <qguRd-7Jr-35@gated-at.bofh.it> (permalink)
References <qfvZ0-4oI-7@gated-at.bofh.it> <qfBBo-43g-9@gated-at.bofh.it>
Organization Baylibre

Show all headers | View raw


On 10/03/2015 09:27 PM, Florian Fainelli wrote:
> Le 03/10/2015 07:26, Neil Armstrong a écrit :
>> If no switch were found in dsa_setup_dst, return -ENODEV and
>> exit the dsa_probe cleanly.
>>
>> Tested-by: Andrew Lunn <andrew@lunn.ch>
>> Tested-by: Florian Fainelli <f.fainelli@gmail.com>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
> 
> [snip]
> 
>>  static int dsa_probe(struct platform_device *pdev)
>> @@ -926,9 +937,9 @@ static int dsa_probe(struct platform_device *pdev)
>>
>>  	platform_set_drvdata(pdev, dst);
>>
>> -	dsa_setup_dst(dst, dev, &pdev->dev, pd);
>> -
>> -	return 0;
>> +	ret = dsa_setup_dst(dst, dev, &pdev->dev, pd);
>> +	if (!ret)
>> +		return 0;
> 
> That logic is a little weird, I would just go with something like this:
> 
> ret = dsa_setup_dst(ds, dev, &pdev->dev, pd);
> if (ret)
> 	goto out;
> 
> return 0;
> 
Yes you are right, the goto out is needed to clean up the of_probe resources.

I will send a v3 with this fixed.

Neil
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 5/5] net: dsa: exit probe if no switch were found Neil Armstrong <narmstrong@baylibre.com> - 2015-10-03 16:30 +0200
  Re: [PATCH v2 5/5] net: dsa: exit probe if no switch were found Florian Fainelli <f.fainelli@gmail.com> - 2015-10-03 22:30 +0200
    Re: [PATCH v2 5/5] net: dsa: exit probe if no switch were found Neil Armstrong <narmstrong@baylibre.com> - 2015-10-06 09:30 +0200

csiph-web