Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp163199lqt; Thu, 18 Apr 2024 11:08:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVOJ2Mpu+dMOgaTQ8CnmLnOOHtG6wsFwQT/ufM80C3znQrcp842iJPtJJt8QxvhVmTCYT5n1iQW6s83DuQJANUczcnLV9Ff7ZgY173NLA== X-Google-Smtp-Source: AGHT+IGqnkaw/GzclFuuZkq0bxBTdYqB37nLIayUXjxSc1Lk9/dNCCXymSOKCVw4U12956rO9zGs X-Received: by 2002:a05:620a:7f3:b0:78d:61a4:6955 with SMTP id k19-20020a05620a07f300b0078d61a46955mr3384711qkk.67.1713463729681; Thu, 18 Apr 2024 11:08:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713463729; cv=pass; d=google.com; s=arc-20160816; b=0Bmk93EBNnqixAehr3Hw3ZLPkVu9EiZppxqlyl6udpczWqgm8xT70xgl6LlRZetMlQ oYTrAe8XhCFSgQU0x36F4B3Zj/sQLsmTvkTgFndLVlINqLLo/MhinKjhXzsVSv0oOw3A 2ptHlk/r7ycWcvoZr8iNiW/qInXaqQ9mZ0v/LDzgo0vooua7wwa5GR0gDq0dOyZoz1B8 GmBZT8CwLVKqpBXsu17yMfe5d+VQF5CSeldRXOipeVzJz1tZAqa2LiZtt6kNJC2uHV1f IZDLWqrxYoS+mKpvYGTT0I3Hoxn+kX7jG+3LNE6/j/z2Szrn7CFrZN2sMRFUGeJiZw+y XmcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=TmjZljf0EWxiHwGWUm5LZmE5fNg+MFxFKT4Nc41DZ94=; fh=mHx57FZtZeh3meJ197TKLY87gwPluwlVtYR/TDJloVI=; b=ISKg107RAhFBab6oWNCVXkyKQalEDhzRkTDmNCFp3A58Jimm7qZ/TSbEab8zxQD4fo p4b0je5h2Wq2AVCl/fPrfNMVPM3EkkId5Ibez9Px1J6c0yyD889VfGwJvNMXfTth8V2r IpxKATOhFERzG7A12m2y0wWMMMhktl1Dr++LuwGrIRZcunap0q1NG/7B/64tYoe7XFSZ 1RG5HieaCfxOeawTijbobQ+ixMZFEg0tIysIFBt35EySClqMyXudnD1T/e8+KzT7yi1f 3sEHfI1lirRGhDf2RXUwL0lpygFpEnliHSXbE/TOkd5Jzf4HQaucdUQjzWwlC/BJtiol zdhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b="bEsc/JMu"; arc=pass (i=1 spf=pass spfdomain=web.de dkim=pass dkdomain=web.de dmarc=pass fromdomain=web.de); spf=pass (google.com: domain of linux-kernel+bounces-150612-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150612-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u26-20020a05620a121a00b0078ec6084369si1867205qkj.476.2024.04.18.11.08.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 11:08:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150612-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b="bEsc/JMu"; arc=pass (i=1 spf=pass spfdomain=web.de dkim=pass dkdomain=web.de dmarc=pass fromdomain=web.de); spf=pass (google.com: domain of linux-kernel+bounces-150612-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150612-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 960D11C21CDD for ; Thu, 18 Apr 2024 18:08:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E9E117AD6A; Thu, 18 Apr 2024 18:08:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="bEsc/JMu" Received: from mout.web.de (mout.web.de [212.227.15.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B06C816191A; Thu, 18 Apr 2024 18:08:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713463714; cv=none; b=OnsyW30yGlKtna7ID+p+dePHmn5xvhImnYVJbiTHPnYw8hDFmbEQEFR+bpYCuRubbjQtRbnqxnQaJ1XqBaS0anopu6nOz5rguDgaxpgwMHyazk3q65qOIfPt5EZEEFLNzTDcSM6+64XELofWkvNz8gkIotx5rSKHjkl2m+YBDzM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713463714; c=relaxed/simple; bh=TmjZljf0EWxiHwGWUm5LZmE5fNg+MFxFKT4Nc41DZ94=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Mg8t7cwhEzmIMMuH3TXSVuhQHOCMbVD6SObcaWsIqNNXR0LB2nCzjjURMC9SHd5UefeomlauTrBIpDjNpqd2PjbNmy1wEaiFZIOgzZtAlwqh2wsXUOlJTZ33MrZtksUc2RLcNbcGsDSceU1ui91xxwobJR8pXjzAAY9J9Q5ez0c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de; spf=pass smtp.mailfrom=web.de; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b=bEsc/JMu; arc=none smtp.client-ip=212.227.15.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1713463702; x=1714068502; i=markus.elfring@web.de; bh=TmjZljf0EWxiHwGWUm5LZmE5fNg+MFxFKT4Nc41DZ94=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=bEsc/JMupATmoAxm8B2A8XriLdLySYnEDhNpv8wE/st8wORDbhodltsGTmTP6wLu fClEkK6ORgs/4GNFB54RIzTf48ZXd73AkiDP9sa/LYAnmxeRi+j3e9Rt2lsduzTAo sbtgODnPgslXvBEhPjOkZzPVNijIZdeTc/z9U4jOafss4T+OL30O3eazSYrUtJhEV 38nVKv5NI0wiuPK87hBgAu/VJfURA97+48Q6O+YE4nLlSUsilz7+xpruDquw5gg73 JRhyavlyyuBVZY3jiVtpaDz/DhY7TRb2BrUc0++aW5pIfJMVGcswiQeG3teDvREVv zeACTy2hl4RwOhfTKg== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MgibY-1seaAE1hCG-00h5rV; Thu, 18 Apr 2024 20:08:22 +0200 Message-ID: <24b3851a-b5c4-4c53-950f-bb5da1a32e11@web.de> Date: Thu, 18 Apr 2024 20:08:21 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [ 2/2] kunit: avoid memory leak on device register error To: Wander Lairson Costa , kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, kernel-janitors@vger.kernel.org, Brendan Higgins , David Gow , Rae Moar Cc: LKML References: <20240418131754.58217-3-wander@redhat.com> <9ff84256-c7d2-48e5-b06b-09a993db2c39@web.de> Content-Language: en-GB From: Markus Elfring In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:twexNX9VepwTcqA7qEc4TIfag0nJfenHdpr/TiWekFjawHJGSxN UUr+HHBRkY/Apa9ofmHZpr3Csc3bovvbecxtntMe788k+N3IWuLQGzQRRW0rKaGnJlYeHIj ppNLvuzE6WpcQSiDXXU3JdvzbtVzZ2jfXz5+1ytMQTWp6qyXSsIr+ijR3ch9G5juztiKJd7 Hvd756os03ZgRZFgyWI3Q== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:wtzbIy0zubc=;CAfGe7b8AUBGtrOaQUk906NOSiM /egr2aEV5fEIAxAB6/DcT23IVyOssxCYTWGPpnEhIGzvqMoHWDky2wFlQ7fjc1bsc/BnsHAVN f9RE6NlszPRTCj02791XHyZS5rXo8+FW5nmQWPSWb+gmUB3h5qwPgn6B2tUVEeg4SS7RRDQNz 2nkCrRKunerBhuCDMQKkmfSBeQEM1bw/rOok1aAKklrDHV1MvL6fya0pg7fM7Vz8jEG7aHyu3 rGW9dDjqg6BKjIRAsfOlVy7hcxjY0uziI8bFGRkwEgjWLCTVuJVl38Wl3fV0XiHG6E+bZWkHJ tTxSCI/QXypZNDUuqqvVqWLhzQ5W7NWQVMfgSZFJgwN5+8mmcgBqnM+kfaLo9+Kwi+amficaD pOB8RlHjBqItq2c+xpfsEMCKi/ZB6b1aD5tDi5IMoCOQ5XUdQdjX4K24VgnWy887TEeCNpfWn uvQXwAE+CP385JfSAQ2Cg1NNgLIGLWUtOrju0RKLEF12KGXjkZeQkYJZLRv9uT3+Tp9hqIlBs AEBQMrr6oX72PooTPfK1EHK8CRSP96ftqRixYgas0AHWXP11G/A/HAsETGCnXtM9X6q7kPNF6 oSM7iDE/+B4tmC2963/qH3G4w3ghvQ/Nsqb9fdJID5M82/PBqIRFW8Qkj8ZDigXj64KDg+HZB 2rysc18b/cnLjC/1WVAfgoGnA2GKwv3unrK8HSzn4VCQJTltymEXVyExLDimKUhg9iSXGUYJO ddPQHDSxLA8mNrX1tv3OLd9S/vAkI0ZRuuEZCYakv9dPKcAQ4mDgkBqVBAdZu/8Jby9tOotZY H4WAjOsXwib0JqA77BoVq4PEx+9uA0ED1Ks9eWJ3HoswM= >> Common error handling code can be used instead >> if an additional label would be applied for a corresponding jump target= . >> >> How do you think about to increase the application of scope-based resou= rce management here? > > I thought about that. But I think the code is simple enough (for now) > to not require an exit label. Please follow a known advice (besides other recommended improvements). https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+go= to+chain+when+leaving+a+function+on+error+when+using+and+releasing+resourc= es Regards, Markus