From patchwork Sun Nov 22 16:11:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 1404509 X-Patchwork-Delegate: lokeshvutla@ti.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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.a=rsa-sha256 header.s=s2014 header.b=XEkX20aM; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CfFj76fVhz9sSf for ; Mon, 23 Nov 2020 03:14:19 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EF4B782612; Sun, 22 Nov 2020 17:12:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.b="XEkX20aM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5D5FD825D9; Sun, 22 Nov 2020 17:11:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,FREEMAIL_FROM, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from libero.it (smtp-31-i2.italiaonline.it [213.209.12.31]) (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 63E87825BC for ; Sun, 22 Nov 2020 17:11:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dariobin@libero.it Received: from passgat-Modern-14-A10M.homenet.telecomitalia.it ([87.2.94.187]) by smtp-31.iol.local with ESMTPA id grxekH1hlQgqqgrxvkn9r0; Sun, 22 Nov 2020 17:11:51 +0100 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2014; t=1606061511; bh=OHL9Z7is4o3hV0iKL61k4yc5w5F0GGwIl+Ri6H4u82g=; h=From; b=XEkX20aMDnL1DSvFWtRUFDwHMwIDL4yiU1wQu0vt+9mL9Ez2RhZIq1sjgNP4SKxtd ftNr2MS9YF50GfP7UyYCh9ONg1jU46xFMh+wym+HQA3K8c/tt7wlCS6Em8Y/ttQvDU R1LEGOE30D1A63mUUpfBZOCWKyyR+jkaJCvwWTgfVAk05ZnATH/BrkfxCsjotX8ui2 Fv275y7kseJwxcffqqH3KoLUs7hlZAy3pyx17rYdKqF22BXT6B0kcPnIH9N5HbZP1o t/Vgb0yBDXA/xO5q5gUb4T6uspU8VChF3jDT6/liHHKwlneVLWco8Gu8WmjJUsFb8Z jMlyz/bK0XSMg== X-CNFS-Analysis: v=2.4 cv=K4fnowaI c=1 sm=1 tr=0 ts=5fba8dc7 a=/8YHF75YQ9f7f3UrJFxoKA==:117 a=/8YHF75YQ9f7f3UrJFxoKA==:17 a=cm27Pg_UAAAA:8 a=FnVStUS9j28AJ5bLaW4A:9 a=xmb-EsYY8bH0VWELuYED:22 From: Dario Binacchi To: u-boot@lists.denx.de Cc: Dario Binacchi , Lokesh Vutla , Simon Glass Subject: [PATCH v6 12/28] ti: am33xx: fix do_enable_clocks() to accept NULL parameters Date: Sun, 22 Nov 2020 17:11:12 +0100 Message-Id: <20201122161128.13753-13-dariobin@libero.it> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201122161128.13753-1-dariobin@libero.it> References: <20201122161128.13753-1-dariobin@libero.it> X-CMAE-Envelope: MS4xfATbyotLDEueWPrYLjBeORDEl0hPUqTPrHkb1ohIs91o+kqLl3diTiLc3kHJ8LRGiWRav2Z3Oq0fosg3/eIg8mJZYd92mc02Sk3xS1CqIGTZOmAgajDW 0inuObR6oGTUMzKLA+sGoCjzg5+hr25NOTAhnHE4HYEFRdhqgrTrVC2O8rT++KP7gofj1URhs+ebOs01NX+sgbtluY6Vy680ofYtktu30Wx/iKeg9/VwVghX OvAfKy1d6r2TfxVfaUtl6+N+6P8HlW19ioPek6m0G18NlyLJ7EWylb4jKZ95YHoBY0QRDNEvHoR7t4xl83y7pA== 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 Up till this commit passing NULL as input parameter was allowed, but not handled properly. When a NULL parameter was passed to the function a data abort was raised. Signed-off-by: Dario Binacchi Reviewed-by: Simon Glass --- (no changes since v1) arch/arm/mach-omap2/am33xx/clock.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/am33xx/clock.c b/arch/arm/mach-omap2/am33xx/clock.c index 8819062aaa..130ee6c6e3 100644 --- a/arch/arm/mach-omap2/am33xx/clock.c +++ b/arch/arm/mach-omap2/am33xx/clock.c @@ -194,13 +194,14 @@ void do_enable_clocks(u32 *const *clk_domains, u32 i, max = 100; /* Put the clock domains in SW_WKUP mode */ - for (i = 0; (i < max) && clk_domains[i]; i++) { + for (i = 0; (i < max) && clk_domains && clk_domains[i]; i++) { enable_clock_domain(clk_domains[i], CD_CLKCTRL_CLKTRCTRL_SW_WKUP); } /* Clock modules that need to be put in SW_EXPLICIT_EN mode */ - for (i = 0; (i < max) && clk_modules_explicit_en[i]; i++) { + for (i = 0; (i < max) && clk_modules_explicit_en && + clk_modules_explicit_en[i]; i++) { enable_clock_module(clk_modules_explicit_en[i], MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN, wait_for_enable); @@ -215,12 +216,13 @@ void do_disable_clocks(u32 *const *clk_domains, /* Clock modules that need to be put in SW_DISABLE */ - for (i = 0; (i < max) && clk_modules_disable[i]; i++) + for (i = 0; (i < max) && clk_modules_disable && clk_modules_disable[i]; + i++) disable_clock_module(clk_modules_disable[i], wait_for_disable); /* Put the clock domains in SW_SLEEP mode */ - for (i = 0; (i < max) && clk_domains[i]; i++) + for (i = 0; (i < max) && clk_domains && clk_domains[i]; i++) disable_clock_domain(clk_domains[i]); }