lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e610c9b6-0491-42ac-90a1-00c547741773@roeck-us.net>
Date: Thu, 22 Feb 2024 08:03:09 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Marek Behún <kabel@...nel.org>,
 linux-kernel@...r.kernel.org, Hans de Goede <hdegoede@...hat.com>,
 Matti Vaittinen <mazziesaccount@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
 Bartosz Golaszewski <brgl@...ev.pl>,
 Lucas De Marchi <lucas.demarchi@...el.com>, Oded Gabbay
 <ogabbay@...nel.org>, Thomas Hellström
 <thomas.hellstrom@...ux.intel.com>,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
 Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
 David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
 Aleksandr Mezin <mezin.alexander@...il.com>, Jean Delvare
 <jdelvare@...e.com>, Pavel Machek <pavel@....cz>, Lee Jones
 <lee@...nel.org>, Sebastian Reichel <sre@...nel.org>,
 Matthias Brugger <matthias.bgg@...il.com>,
 AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
 linux-gpio@...r.kernel.org, intel-xe@...ts.freedesktop.org,
 dri-devel@...ts.freedesktop.org, linux-hwmon@...r.kernel.org,
 linux-leds@...r.kernel.org, linux-pm@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH 1/2] devm-helpers: Add resource managed version of mutex
 init

Oops, sorry for the noise. Shortened reply below.

On 2/22/24 07:24, Guenter Roeck wrote:
> On 2/22/24 06:58, Marek Behún wrote:
>> A few drivers are doing resource-managed mutex initialization by
>> implementing ad-hoc one-liner mutex dropping functions and using them
>> with devm_add_action_or_reset(). Help drivers avoid these repeated
>> one-liners by adding managed version of mutex initialization.
>>

[ ... ]

>> +static inline int devm_mutex_init(struct device *dev, struct mutex *lock)
>> +{
>> +    mutex_init(lock);
>> +
>> +    /*
>> +     * mutex_destroy() is an empty function if CONFIG_DEBUG_MUTEXES is
>> +     * disabled. No need to allocate an action in that case.
>> +     */
>> +    if (IS_ENABLED(CONFIG_DEBUG_MUTEXES))
>> +        return devm_add_action_or_reset(dev, devm_mutex_drop, lock);
>> +    else
> 
> else after return is unnecessary.
> 
>> +        return 0;
>> +}
>> +
>>   #endif
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ