From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932221AbdJYQ6k (ORCPT ); Wed, 25 Oct 2017 12:58:40 -0400 Received: from mout.web.de ([212.227.15.3]:57758 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751312AbdJYQ6i (ORCPT ); Wed, 25 Oct 2017 12:58:38 -0400 Subject: Re: iio/accel/bmc150: Improve unlocking of a mutex in two functions To: Hans de Goede , linux-iio@vger.kernel.org Cc: Hartmut Knaack , Jonathan Cameron , Lars-Peter Clausen , Srinivas Pandruvada , LKML , kernel-janitors@vger.kernel.org References: <66d582a4-a77e-cd78-4215-49587ec2259e@users.sourceforge.net> <6a2c614a-4d0d-f2d2-1689-4c67a2fc3eea@redhat.com> From: SF Markus Elfring Message-ID: <7a76d804-797c-8a7f-a755-9e42f9157287@users.sourceforge.net> Date: Wed, 25 Oct 2017 18:58:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <6a2c614a-4d0d-f2d2-1689-4c67a2fc3eea@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:8XC+FifpyPe200c2kwHhg4RS9Vfog6/ORVNZDu5Hn2v5XFZYUVu BC4OnRrcZDIbu7rsddbWfljmTspiTzYPrcCFb6oRPd8+LduiQeg4ijrQOkae4hCVhl3bc7x qq2O4rrZM4sd+hM/ZXF+95Hp1bEsXVBSM327g0WALZu13o0W4wqly+oGAixyumfrGZt43qL rIzNv/0vXzbKXx1Fj093g== X-UI-Out-Filterresults: notjunk:1;V01:K0:fzPLcfLebZ4=:if9bXmhxFjJwsqTEf6twDe L22nJoas6C3E9mY9hNEPUwXhetIJN02o4nyvJhAGzgvC2oyIC2jab/ISeTWTVC6t28SKfYpxO +mDZipIkEFWunvQyuz/VHYPb8se786ApR6TmIaNLmUkBJIs8X/BL7vTiftNMPrJB6pjsVrRvf N7dHE9ufGGi7NIP0fOT49OhfjbIxFvkDwJvoZbShRyjvfkyfMuBl3oUmy397L03ScN9Ru9+WX 71/pbGzJNjoxEzMe4h16g/OxvZpt1y42GBrGUIfG+ePObxSyipMbx+lY4NBN+fUPcHSelCwi8 CLK/VWa5l2EsZD7Kfp4aRoBMCIG8KxJc0G4DdzgjTF17mn37d1Of8Csl0WUpX/7Vq5w82RtvB +LxQQprJOjDCR/knr1t54VX2LYjQlN5kZnY0yF9Z7wlBqt5QGMmtY+912/jqiNL2Ghwf3qhSn vs0/2a+k2JbSmXHyUpe83H64SWhFlQcYs8llPNUUYuOQjhEHxk7ZpRgwebLYKPr0exwJLMs38 IZ6Yy/lWyFuGQoP9Jl6bf1hx2trlQGfJdFTEu2BRM/+hyckrpfQEOJleVakeQUmTnLC31U5C7 4GV+jFNfpSkNUYGE/KDMUmtIDAfIrEWfCD+l9xAEhaUA0e4J8Y1XNS3+t8BNQj8fDX7j1gKLy bcYmhSEVRi9YHVS6QeVozs807Td1rS18vZJPq2F1fBsOVJx+O3zv0uve37sZqY/LqOVncC+LI pKCjiZe90qKaSa5OJMlCydY+GhxpqvSv+G6w1APTtynx+CnFaHHldF1Hw2LzgLn0Fs7m++SsW XPH1HAohoVWDACxfcKJJ5E7SjMpd9DhC6lynrq9sqQ/q7q8NvY= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > If that is the only unlock in the function, then it is probably > best to keep things as is. In general gotos are considered > better then multiple unlocks, but not having either is > even better. Thanks for your quick feedback. >> How do you think about to use the following code variant then? >> >>     if (!ret) >>         ret = IIO_VAL_INT; > > > I believe the goto unlock variant and setting ret = IIO_VAL_INT; > directly above the unlock label variant is better, I would prefer the approach above so that an extra goto statement could also be avoided before. > because that way the error handling is consistent between all steps > and if another step is later added at the end, the last step will > not require modification. Do any more contributors insist on such a code layout? >> How long should I wait for corresponding feedback before another small >> source code adjustment will be appropriate? > > That is hard to say. I am just curious on how we can achieve progress here. > I usually just do a new version when I've time, This is generally fine. > seldomly someone complains I should have waited longer for feedback > (when I'm quite quick) but usually sending out a new version as soon > as you've time to work on a new version is best, since if you wait > you may then not have time for the entire next week or so, at least > that is my experience :)  There is really no clear rule here. I asked also because other well-known contributors showed strong reactions for this change pattern (with the help of a script for the semantic patch language). Would you care for similar updates in source files like the following? https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/iio/accel/kxcjk-1013.c?id=1540d0106bcbc4e52013d759a0a0752ae7b4a09d#n760 https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/iio/accel/stk8312.c?id=36ef71cae353f88fd6e095e2aaa3e5953af1685d#n432 https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/iio/adc/palmas_gpadc.c?id=36ef71cae353f88fd6e095e2aaa3e5953af1685d#n304 Regards, Markus