From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 6566A14D431 for ; Fri, 12 Apr 2024 17:07:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712941657; cv=none; b=IS1pykVbykByu+dsbWPP6RHIkPxJpYVrlTA7RR+HUH08A9gey1Umz/W3gxZvs5lL5CSAChHWbo1A8DlIbHNQNXrb2RjspC9xazhChv+nu8uEl9MNgFlKyhs3eL0HuBVfjN6S/gecMq880S2LaR5I+VUKJE0cuaWb1/0PZRQvtCE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712941657; c=relaxed/simple; bh=B04EjOgsZVPqyEh4DH0TEKubNhHXrgRXG0HP80hbpPM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uWMORwkRYH2uRFLVhYyYRLO8AeL+IBNMfGrSFechGJ1zkbQJZCZkqdeHlRRmD93GQqrExXuV8wK+aJ4KoZB/sIXAv3FOmPO4eJkWeodW4AJqjddTVNlP52KJo29hJAtato29yFmO+9gsG+ZjYJ7kanASkI72j9JN4a1HWmjJ6Vc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=b10B7Zi0; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="b10B7Zi0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712941655; x=1744477655; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=B04EjOgsZVPqyEh4DH0TEKubNhHXrgRXG0HP80hbpPM=; b=b10B7Zi0lnKMtSy1RA3NDLHw5qy0Ro2cTRDPrw6o0VSlaIGrw0w4BAQS jPdQj6EGPuo+IU5mAyHu9bsW6rwx5frf03ioygOtaQukmujVEhZIgSfid yfi+luUfQ1ZGEXw5AqeG3cUpS1hBpnJy8aPEyen6IldC8YOqQtO9RFsJv DGHWO7F7/YOVhtKKJG4oy73A4Mx1XJfNmLV3toAiqaVGghKzwbnQik9r3 Uoj7XVzN0wLl5iHCipNxd9rYMOAtBIMo3MUbhRhYAAwQdGTDwl88ncslo tNcNc68Sr70Xxb85h8KY38z65cA3HbdXsF2enMdlXLeDZBBbeSsb/kykD A==; X-CSE-ConnectionGUID: Rd8mZuETSky9+C9Yn7z5CQ== X-CSE-MsgGUID: MBIRj0M3SEiXo6L2IlDyoQ== X-IronPort-AV: E=McAfee;i="6600,9927,11042"; a="8958757" X-IronPort-AV: E=Sophos;i="6.07,196,1708416000"; d="scan'208";a="8958757" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 10:07:34 -0700 X-CSE-ConnectionGUID: 1+gUySJsSrWAvD9uZENAsg== X-CSE-MsgGUID: 8FxrbthFQo6bvN8zu8QswA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,196,1708416000"; d="scan'208";a="25976939" Received: from smile.fi.intel.com ([10.237.72.54]) by orviesa003.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 10:07:33 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rvKN8-00000003iHk-0Gx1; Fri, 12 Apr 2024 20:07:30 +0300 Date: Fri, 12 Apr 2024 20:07:29 +0300 From: Andy Shevchenko To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Greg Kroah-Hartman , Raag Jadav , linux-kernel@vger.kernel.org, kernel@pengutronix.de, "Rafael J. Wysocki" Subject: Re: [PATCH] driver core: Make dev_err_probe() silent for -ENOMEM Message-ID: References: <20240412164405.335657-2-u.kleine-koenig@pengutronix.de> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Fri, Apr 12, 2024 at 07:03:01PM +0200, Uwe Kleine-König wrote: > On Fri, Apr 12, 2024 at 07:51:48PM +0300, Andy Shevchenko wrote: > > On Fri, Apr 12, 2024 at 06:44:05PM +0200, Uwe Kleine-König wrote: > > > For an out-of-memory error there should be no additional output. Adapt > > > dev_err_probe() to not emit the error message when err is -ENOMEM. > > > This simplifies handling errors that might among others be -ENOMEM. > > ... > > > > BUILD_BUG_ON(err == -ENOMEM); > > > > Done! > > Well no, that doesn't do the trick. Consider for example device_add(). > That function can return (at least) -EINVAL and -ENOMEM. To properly > ensure that the error handling is silent with the current > dev_err_probe(), we'd need to do: > > ret = device_add(...); > if (ret) { > if (ret != -ENOMEM) > return dev_err_probe(...); > else > return ret; > } > > With my suggested patch this can be reduced to: > > ret = device_add(...); > if (ret) > return dev_err_probe(...); Fair enough, but these two should be combined. Mine is for the rejecting a dead code on the phase of the submission. -- With Best Regards, Andy Shevchenko