Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3458841imu; Fri, 30 Nov 2018 00:10:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/VvuVTHAHACEPz5j+BzGFUGVI52d+yPmduGO+U0zwPM5e/7FjHzYg39LQMGOC2Fz/rxPwQk X-Received: by 2002:a63:ab08:: with SMTP id p8mr3962971pgf.87.1543565457444; Fri, 30 Nov 2018 00:10:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543565457; cv=none; d=google.com; s=arc-20160816; b=Msrz+o4WpOFbUdgH7tw678e1wg0Ch2Ozvh3OnXnr+eicoURHav2U7bUAnUKkltZrAw pRS5gdtslpxeeBE2gsx8YYB0kkzcKMZnPRvnbdOnF5Dyf9uFlt+LQOFWmytpBnlYhEJW 7NcAlFGMaC0XfxF5It5ACDCFs6Tn2cFza8IF4lzUH3Abnx1kuc6wlT/k4EK3KcZfVWZm +aNPl6SB8QBUL3cOlek19vM+R+3ebLaXD9JMNmTy2TFkfdfPEqWcRiUuOh23QzLLLt1Q mxU/Pxs5NiNGEjupYzB9WUyAnNucFSWU/Eb10CcVeGGov1U198f5MaFzR/86A9XgqmkC jWoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:dkim-signature; bh=z2MYl/L4IAF4r+79sfPwnl6D6NuGsc2wixsEvrIf0ZA=; b=E3Kt3hKVx4JK/sFQRxs9tESF9qj2aHxITbI9+RoR33EZiZoBrdUBhpgbYH/H/84L33 txNrUD21lMSYlcBEiRm75JVs0TuYR/qt5uJu4aDgm5gy5yXjc73m2WvzYQwGoym0VxeO kH9vg5/0FX1KwexywmEoobkTtWqmoc6Yu58zezq1G7aNqCXIbC1yzeH0xYZpdYw+GsHY 2WnF2eegwr2dTJCgpTg0tw4hF1W+ZVJ/79RqKtBeTUSnGnSZJd3I3UkCQ693doX5qi7y K1DYHBMmrw+6ehlQplgjHyfPaX2MKYjcAMEcbfd+Oo5h5NNNHrzqSNAGAzIZChYn0/Rv WcNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Jjnx8ABa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r2si4316970pgk.389.2018.11.30.00.10.42; Fri, 30 Nov 2018 00:10:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Jjnx8ABa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727394AbeK3TSA (ORCPT + 99 others); Fri, 30 Nov 2018 14:18:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:39080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727346AbeK3TR7 (ORCPT ); Fri, 30 Nov 2018 14:17:59 -0500 Received: from localhost (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 366A4206B7; Fri, 30 Nov 2018 08:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543565371; bh=z2MYl/L4IAF4r+79sfPwnl6D6NuGsc2wixsEvrIf0ZA=; h=To:From:In-Reply-To:Cc:References:Subject:Date:From; b=Jjnx8ABaORiNLC5WxoUNmp2HalHlHznh5JNFO/IkMo49ydzD3l3yZHlt1s5v7O8E8 qRgN/dgzGa0cQRVpdFpzRCAiQg3yA/1EpMxcukZkf+Cuxgvp3SI1GJpOJSdiuEdYrw 8N5C7nzXz3ovQPbHHJxqhZgusO2xhhb5S6pxIOek= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: Nicholas Mc Guire From: Stephen Boyd In-Reply-To: <20181130075453.GB2456@osadl.at> Cc: Michael Turquette , Nicholas Mc Guire , Michal Simek , Rob Herring , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <1542803310-32673-1-git-send-email-hofrat@osadl.org> <154353512315.88331.4548631955021366823@swboyd.mtv.corp.google.com> <20181130075453.GB2456@osadl.at> Message-ID: <154356537055.88331.12823387821854167503@swboyd.mtv.corp.google.com> User-Agent: alot/0.7 Subject: Re: [PATCH V2] clk: zynq: do not allow kmalloc failure Date: Fri, 30 Nov 2018 00:09:30 -0800 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Nicholas Mc Guire (2018-11-29 23:54:53) > On Thu, Nov 29, 2018 at 03:45:23PM -0800, Stephen Boyd wrote: > > Quoting Nicholas Mc Guire (2018-11-21 04:28:30) > > > The kmalloc here is small (< 16 bytes) and occurs during initializati= on > > > during system startup here (can not be built as module) thus if this > > > kmalloc failed it is an indication of something more serious going on > > > and it is fine to hang the system here rather than cause some harder > > > to understand error by dereferencing NULL. > > > = > > > Explicitly checking would not make that much sense here as the only > > > possible reaction would be would BUG() here anyway. > > > = > > > Signed-off-by: Nicholas Mc Guire > > > Fixes: 0ee52b157b8e ("clk: zynq: Add clock controller driver") > > > Acked-by: Michal Simek > > > --- > > = > > Nak. We don't have any __GFP_NOFAIL in drivers/clk and I don't see a > > reason why we would want it here either. Just handle the failure, or > > don't care if this is so critical to system boot. > > > It was not motivated by the criticality but by the low probability > and cluttering the code for this case did not seem good to me. > Effectively handling it here means BUG() - so more or less > the same result that hanging it on __GFP_NOFAIL if allocation > was not possible would cause. > = > Not clear what the objection to __GFP_NOFAIL here is - my understanding > was that it is intended precisely for cases like this - but > I=C2=B4ll send a V2 handling it with BUG_ON(!clk_name) if that is prefere= d. > = Or just WARN() and return. Maybe something else can get far enough to be helpful. I would also appreciate if this sort of problem could be caught earlier in code review and/or with some automated scripting. Debating BUG_ON() and allocation failures is not what I look forward to doing so please try to make this exact sort of patch never make it to the list in the first place.