From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: iio/gyro/bmg160_core: Improve unlocking of a mutex in five functions To: Jonathan Cameron , linux-iio@vger.kernel.org Cc: Greg Kroah-Hartman , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Pravin Shedge , Quentin Schulz , LKML , kernel-janitors@vger.kernel.org References: <16623de4-351d-135b-f3ff-701a465c5d92@users.sourceforge.net> <20180317195422.037a8b57@archlinux> From: SF Markus Elfring Message-ID: <73f0a187-57d1-c877-ba9f-3b15f6a61640@users.sourceforge.net> Date: Sun, 18 Mar 2018 09:19:47 +0100 MIME-Version: 1.0 In-Reply-To: <20180317195422.037a8b57@archlinux> Content-Type: text/plain; charset=utf-8 List-ID: Am 17.03.2018 um 20:54 schrieb Jonathan Cameron: > On Wed, 14 Mar 2018 16:15:32 +0100 > SF Markus Elfring wrote: > >> From: Markus Elfring >> Date: Wed, 14 Mar 2018 16:06:49 +0100 >> >> * Add jump targets so that a call of the function "mutex_unlock" is stored >> only once in these function implementations. >> >> * Replace 19 calls by goto statements. >> >> This issue was detected by using the Coccinelle software. >> >> Signed-off-by: Markus Elfring > > Hi Markus, > > Some of these are good and sensible changes Such feedback is nice. > - others break the code. Which concrete places do you find questionable here? >> - return ret; >> + >> + goto set_power_state; >> default: >> return -EINVAL; > We exit with the mutex locked now and it should not be. I wonder about your source code interpretation here. The mutex was (and is still only) locked within case branches, isn't it? > >> } >> >> return -EINVAL; > Mutex is still locked here and the return is wrong. Should this statement get any more software development attention? Regards, Markus