On Tue, Nov 06, 2012 at 04:04:09PM +0530, Laxman Dewangan wrote: > When regulator_register() failed due to non availability of > mutex_unlock(®ulator_list_mutex); ... > } > EXPORT_SYMBOL_GPL(regulator_put); > @@ -3453,11 +3460,10 @@ scrub: > gpio_free(rdev->ena_gpio); > kfree(rdev->constraints); > wash: > + if (rdev->supply) > + __regulator_put_locked(rdev->supply); > device_unregister(&rdev->dev); > - > mutex_unlock(®ulator_list_mutex); > - if (rdev->supply) > - regulator_put(rdev->supply); > > /* device core frees rdev */ > rdev = ERR_PTR(ret);
Here would it not make sense to go slightly further and basically revert my original change. This feels sensible as it keeps it at only one location where the mutex is unlocked and removes the second exit point I added. This would effectively make the code look like: scrub: if (rdev->supply) __regulator_put_locked(rdev->supply); if (rdev->ena_gpio) gpio_free(rdev->ena_gpio); kfree(rdev->constraints); device_unregister(&rdev->dev); /* device core frees rdev */ rdev = ERR_PTR(ret); goto out; Otherwise the change looks great to me. > -- > 1.7.1.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/