Re: [PATCH net-next v3 5/6] net: ravb: Do not apply features to hardware if the interface is down

From: claudiu beznea
Date: Tue Feb 13 2024 - 13:55:43 EST




On 13.02.2024 13:07, claudiu beznea wrote:
>>> @@ -2566,15 +2566,23 @@ static int ravb_set_features(struct net_device
>>> *ndev, {
>>> struct ravb_private *priv = netdev_priv(ndev);
>>> const struct ravb_hw_info *info = priv->info;
>>> - int ret;
>>> + struct device *dev = &priv->pdev->dev;
>>> + int ret = 0;
>>> +
>>> + pm_runtime_get_noresume(dev);
>>> +
>>> + if (!pm_runtime_active(dev))
>>> + goto out_set_features;
>> This can be simplified, which avoids 1 goto statement and
>> Unnecessary ret initialization. I am leaving to you and Sergey.
>>
>> if (!pm_runtime_active(dev))
>> ret = 0;
>> else
>> ret = info->set_feature(ndev, features);
>>
>> pm_runtime_put_noidle(dev);
>> if (ret)
>> goto err;
>>
>> ndev->features = features;
>>
>> err:
>> return ret;
>>
> I find it a bit difficult to follow this way.

Looking again at it, your version seems better.