Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753768AbbBEXkr (ORCPT ); Thu, 5 Feb 2015 18:40:47 -0500 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:51199 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752422AbbBEXkq (ORCPT ); Thu, 5 Feb 2015 18:40:46 -0500 Date: Thu, 5 Feb 2015 23:40:40 +0000 From: Russell King - ARM Linux To: Wolfram Sang Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] clk: return proper ERR_PTR for clk_get when !HAVE_CLK Message-ID: <20150205234040.GV8656@n2100.arm.linux.org.uk> References: <1423163365-15267-1-git-send-email-wsa@the-dreams.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423163365-15267-1-git-send-email-wsa@the-dreams.de> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1182 Lines: 29 On Thu, Feb 05, 2015 at 08:09:22PM +0100, Wolfram Sang wrote: > clk_get functions return an ERR_PTR and not NULL in the error case. Make > that consistent for the dummy functions when HAVE_CLK is not enabled. > Otherwise unexpected codepaths might be trying to use a NULL pointer. NAK. There are some drivers which rely on this behaviour (take a driver, such as some PXA IP) which uses the clk API but is also reused on x86 which doesn't. Remember, for any clk API implementation, it is well defined that the clk API should safely eat any struct clk that clk_get() may return which isn't a pointer-error. So, if an implementation returns the NULL pointer, then the clk API functions must accept it without crashing the kernel. Also, clock consumer drivers are _not_ allowed to dereference struct clk. Absolutely not permitted. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/