From patchwork Wed Aug 5 15:11:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 1341258 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=btRZkRPd; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BMFVG4712z9sPC for ; Thu, 6 Aug 2020 01:12:36 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E85CF8217F; Wed, 5 Aug 2020 17:12:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="btRZkRPd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B80D182185; Wed, 5 Aug 2020 17:12:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from esa3.microchip.iphmx.com (esa3.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E9A8C81E3C for ; Wed, 5 Aug 2020 17:12:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=Claudiu.Beznea@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1596640334; x=1628176334; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=tan/+fYfkxj7SC8W8GJgg1pRjwNIiVuxEbkgnJPep/k=; b=btRZkRPdLVWNfPwKjyj4F71jySmiqTO0dgWx4ZtY33yuoFngDCHWrGIG iCpEDZXxUhL7xgu/p+gTkC4sx2nI2N8zZaXnnEa555rXd9KqbM+g9gWvK 53rN+47PkXz2lOhishkv8P5e9LxVfRgz+Bvl9ZOI/zWjwM7inlZRoqcCr /mlZeH3I6i7xAJM6kM8WfcH8yBcCsDewzyCGhy/muzVaeFO6tI4Yb7B4b ujcPuze6UvPAcH5eqZEB0iOAgpqivVYw6XbeFRT6qUlrIMm5vC3Rbek0P LT9NADHQw8UoFs8hjiom1KLeeNOStVl8xOeL0YHVy4TVKhxuuFvVKbAon Q==; IronPort-SDR: kneDyc9JJEEw1TkpssjjlA8r5AcJiqrd2QRi8p2Md1I/4qGw6hNLT8KboIBWuu2hSD4C+cRreA z3t5nZvbprlWU9Cu7TYGQqtU2CgzOPW+OHQcHq4G5isEMlVbS5CbzJyCag1ywJQIHa9sJuGXAi QGWiuMw6hpLbrX2RkhtDQNXh1EaaQsaw7YvqYgE8yxGcPvLjATSWajnfucg2U3qnhEvxe63vX5 IjvsEDPIA17FLlUkchHE+0dYVTIiFX7pOL723sgrNWTvN0KbDWlJ2Zl/W7Lknq+CIP3uINV/tc tXI= X-IronPort-AV: E=Sophos;i="5.75,438,1589266800"; d="scan'208";a="86799898" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 05 Aug 2020 08:12:11 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 5 Aug 2020 08:12:09 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 5 Aug 2020 08:12:06 -0700 From: Claudiu Beznea To: , CC: , Claudiu Beznea Subject: [PATCH v2 01/21] clk: check hw and hw->dev before dereference it Date: Wed, 5 Aug 2020 18:11:45 +0300 Message-ID: <1596640325-20014-2-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596640325-20014-1-git-send-email-claudiu.beznea@microchip.com> References: <1596640325-20014-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Check hw and hw->dev before dereference it. Signed-off-by: Claudiu Beznea Reviewed-by: Simon Glass --- drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 0f55ba751c0f..56ae1e7e265f 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -57,6 +57,9 @@ ulong clk_generic_get_rate(struct clk *clk) const char *clk_hw_get_name(const struct clk *hw) { + assert(hw); + assert(hw->dev); + return hw->dev->name; }