From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751345AbdKUSrK (ORCPT ); Tue, 21 Nov 2017 13:47:10 -0500 Received: from mout.web.de ([212.227.17.12]:54196 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751184AbdKUSrI (ORCPT ); Tue, 21 Nov 2017 13:47:08 -0500 Subject: Re: [PATCH] selftests: posix_timers: Use common error handling code in two functions To: shuah@kernel.org, linux-kselftest@vger.kernel.org, Frederic Weisbecker , John Stultz , Stephen Boyd , Thomas Gleixner Cc: LKML , kernel-janitors@vger.kernel.org, Shuah Khan References: <3ce187fa-a6df-a419-6924-ea12bf837972@users.sourceforge.net> From: SF Markus Elfring Message-ID: <26ab24f1-cc65-17c1-2284-84cf5970506d@users.sourceforge.net> Date: Tue, 21 Nov 2017 19:46:46 +0100 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: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:ry1HOt1FdF7QXhIvusTy2rjFXdop5ccLOZ3swFvVAHzGd9l0ePe OH0vqIc/cWysvBq5pu6Hb06UbGFXjIeK7UbO42cIaqUYXGOx64lb6/+FYn/Z6erw8HBkXi0 e5TmidPYyUnybYScUMfN+7XGpeyQS1fQ22QVD7PZLDiOUMUywUgg2cKGRcwvKEQ+iDXogJf 4+QkXeLBbaEbv7OiS1hMA== X-UI-Out-Filterresults: notjunk:1;V01:K0:nF6DVXLKDc0=:NJjmHZo6utc3vK4I0YrO6g ksLidbZrNKF8fT/y4Qp7NwDQnelpIFa8bPc/Mc8QqDSi7aaAXQdkf2WHIQeAECV5X9xJehFgd wMeZRYOq8ccHSUJqma8xCvMWk52M9XL8BICAu38U5dkfhUnxV+2u6fqWLzB7YQJSTmU1m5HIZ QSbZ0y3GAt7cvGeqr0y3ZdJ4NCx/UxpjhQ3nQd4VVWsWjtdPsqmlrltSBP+rISzlNtMSB1Z7C 8JuOqC1zyG7A7D50s1Gd12ZUfsDVDFCs5iji9No1jhXobdYETpFeRoxVZgunqI4o6KK7+NIG2 goqlee1y3bacTIfpbo21/breH9SYQxFZujl321zufM2hbkRbqi4YvjRTmNVqNF12wj7rCpvMd P2sBt4ecjtp83i2FFq5OwileKvGzNwpYqvLTirUV+Z12L53MepfWQxjPgND5d/1c2hj0NwrSz 3QJeb7kBFtjbytGMFG/W69KeFTnerJnVcMW8lsCuYaSJHWRTHlA27nCyxPVPHaLyE36fe8xH0 4oEWz1uZpCgzT4+5CB/iVjpVidZWbTYW9hAyVfMIQeE1iPpd9PjIR66kj/ZTGqMXnpl3Uq/zb lxHm7FGUGtBIAd3hejRezRS94JEuQx5J7aslxh7/ONc4lkW1itNZE/7E+sYZqZfw+XTPAWlbQ OcX/mfazrR6ysH3HHO8CmYj1dYbaG1aF2dh8bhG5CChEh4LUQPnXKInQR8RXNfrWZ1Vh8UdFT hbhNgkgyQzkaiQdITEgoRRtNtVVKalxOcrZFVLD9kPDd8P60MWmtB+JFso3RYH3Mt5DlttcNR ZwsP8tV88u7ZSDs7fpgkS9PMfFh83cDdXBczwr/hWyLCB4p3Uk= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> Add jump targets so that a bit of exception handling can be better reused >> at the end of these functions. >> >> This issue was detected by using the Coccinelle software. > > Please include Coccinelle report in the change log. I guess that I can not append the kind of report you might be looking for so far. This small update suggestion is just another result from one of my evolving scripts for the semantic patch language. It was discussed under the topic “Comparing statement lists with SmPL” to some degree. https://systeme.lip6.fr/pipermail/cocci/2017-August/004388.html >> @@ -104,10 +104,8 @@ static int check_itimer(int which) >> signal(SIGALRM, sig_handler); >> >> err = gettimeofday(&start, NULL); >> - if (err < 0) { >> - perror("Can't call gettimeofday()\n"); >> - return -1; >> - } >> + if (err < 0) >> + goto report_failure; > > Instead of report_failure, makes this specific to the failure. > Something like, gettimeofday_error Would you like to achieve unique error messages in this use case? Regards, Markus