Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp659540lqt; Fri, 19 Apr 2024 06:59:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU7/Su4OWFkCSE94jOluf9MW+YanaZYIXi5Mox8A9RXZRbH9je7pdGe/v/GN1K7Ty9rVnQ9dyl0/evY1kTZRq3565s4L3cW1zuoTtghiQ== X-Google-Smtp-Source: AGHT+IGWqZv5JpOQGyxXm0bOKgAc3K5NUpWfKTn0U1ZhhbplQ/F+inu81woSff4WFx7k+isCuMXW X-Received: by 2002:aca:d01:0:b0:3c6:e8d:3ef0 with SMTP id 1-20020aca0d01000000b003c60e8d3ef0mr2243052oin.49.1713535198006; Fri, 19 Apr 2024 06:59:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713535197; cv=pass; d=google.com; s=arc-20160816; b=tcnvZUpP2Jz4/fP36R+oOm/17RaYg8dRkjk5IaP+ORjGkKsguHoXNYRugDRXSrDpJG 1ztPDdOYUpWVHp0WwdODbuGeD/CwyRI5y511D8zBQUVC/1z+8cTWEHcV/14KOPGBPN7k /QZcU3arVXdwkmL5zoKXVWkHSZNALXHReB8cohU2PFV8vyqqQlT4jlHtQggx2zdHqYDh MvtvaJ5CsimmLMMoyETs/FSKIYIwCeUsjHpeB52mJYSbyUfrOBjyWxy0zcM0hNWjzfTE pErBsFy+21L0olGOtULNLszcqjb+35c2uOMx49lK1SR0jhMpW3wcGQV70ugKsutXNY+u g46g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AT040Tb7bQE/77es8ebKtayNvTAhhyOeH5Z2fHttnqU=; fh=mL6SKtG+GHDXMxBs0mz+fKGoUTX0x5w3Tm/qy7foHdA=; b=WL8pXga3/Ag8ab3+xQnj1nRN5aeTiYkaLItvh7vITwPaypXmpGTV3cCe4XqWNZ6Kxd SFaGTpNHuMpYeyWhEVMsX1b4dpiC98U72ji10QcdhkSenwnpsgXMTbFv+4VTz9TIDOCo 1YTbXJ3vYKpfE1TWl+qRrldftac4O2R4vsd6hLfwsHtutNdZ87opitAjONIG9oDDDwoV 3l3iAbOtsZW0H92YIw0tArfeKZOHEPy7DSIXSa89dwP7Q69MxBHRM2ky6Ke0RtfpSKq1 AfD/BEex7hOFEn5YG5gCufOcEdZKzwp7K/ZxysT6brt9Ex3EgqT/z4t6LhKyMenKe0LW bA1w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WArAd6Dd; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-151513-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151513-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l38-20020a635b66000000b005dc48468987si3168005pgm.754.2024.04.19.06.59.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 06:59:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151513-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WArAd6Dd; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-151513-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151513-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 942282842EB for ; Fri, 19 Apr 2024 13:59:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BBC7212D745; Fri, 19 Apr 2024 13:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WArAd6Dd" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D9AA212CDBF; Fri, 19 Apr 2024 13:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713535193; cv=none; b=H4SrxgnmUydsiNhgJ+sxIYbu7iAp7SJhrD80CYUA0vJ6gLbHHELXM0G41A0lo2n6m8SvInMB9mge6ewJpc6aMauWTdzEku12kdT1bK2FbraNlaGu6gptpSpw4QuL6n+FNieHEHa5Q1D4kNFGOJyVRezVRPisC345HLRXMnsbiqg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713535193; c=relaxed/simple; bh=t7Rb5hCY4Np00gpS6uJ1Fonk+kodFdWdVd1OfwvnTcs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hRZ8AJUXpn++8Z2NSfIuGHR3GEwbovgoOdlRhX1hxl9uSl4ZqAYcXchFh4ssFEdWDdcNiKJtw2fIUsridR8b4dwqcOhpC06hJuJwyvSP14/H3In3Ao8CwGx8+ExCSgOiZ2r04gdCs03Xufb0GzI03w6UJkVeLj9nepcMTMBCKiI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WArAd6Dd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB0FFC072AA; Fri, 19 Apr 2024 13:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1713535192; bh=t7Rb5hCY4Np00gpS6uJ1Fonk+kodFdWdVd1OfwvnTcs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WArAd6DduSO//Nqx/0pdrXzNJvfql/DoLNuvlPuuLwDR7HFVh4akn7IbO0tpEmwTW HouGLmClbfk0Mwzp8RDOOGCrJQI9eejPj9dc5r94VPMwaVUuBBDzverIFP9bQWlBMZ 487/xjo7/l41WiPMMdsMqY8HNzHvCg5RvgZh9CPw= Date: Fri, 19 Apr 2024 15:59:46 +0200 From: Greg Kroah-Hartman To: Wander Lairson Costa Cc: David Gow , Brendan Higgins , Rae Moar , Shuah Khan , Maxime Ripard , Matti Vaittinen , "open list:KERNEL UNIT TESTING FRAMEWORK (KUnit)" , "open list:KERNEL UNIT TESTING FRAMEWORK (KUnit)" , open list Subject: Re: [PATCH v3 2/2] kunit: avoid memory leak on device register error Message-ID: <2024041941-declared-footrest-9e8f@gregkh> References: <20240418210236.194190-1-wander@redhat.com> <20240418210236.194190-3-wander@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Apr 19, 2024 at 09:30:06AM -0300, Wander Lairson Costa wrote: > As a side note, the behavior of device_register() seems > counterintuitive and error-prone, IMO. If the function returns an > error, it should ensure it leaks no resource and shouldn't require the > caller to do any cleanup. I too want a pony, but that's not the way the code works here, sorry. It's always been like this, and has always been a problem, but last time I looked, there was no way to really fix this. That's why we document it a lot to make sure people don't get the error paths wrong here. I know it's a pain :( sorry, greg k-h