From patchwork Sat Jun 9 08:39:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 10455465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F216560234 for ; Sat, 9 Jun 2018 08:39:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D62261FFFF for ; Sat, 9 Jun 2018 08:39:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C57912013C; Sat, 9 Jun 2018 08:39:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48D461FFFF for ; Sat, 9 Jun 2018 08:39:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753207AbeFIIjT (ORCPT ); Sat, 9 Jun 2018 04:39:19 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:38622 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751581AbeFIIjS (ORCPT ); Sat, 9 Jun 2018 04:39:18 -0400 Received: by mail-wm0-f68.google.com with SMTP id 69-v6so7649544wmf.3 for ; Sat, 09 Jun 2018 01:39:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kEUGDhitEY6xsJm89tkety9CIbLqt8CSTdsGqx2l9tw=; b=lmlZw0HZZga+gn34mOvtQ8E7KXVM6C8YHPerw2HjmmYHpNOHsQzXahG7jvKF+pl2HB dErqcPOK0m2IEb9U7h/i723m9doGyynf/TWQimG6RkA+coiH4VPPAgSJnylDwPFUT74J Y7b1kDfkmh/BURxF0ey52fMyJom3alf57AebHznAiu/+jLqHc/sUqjMJe7AK5L+BV9NN WhVMKocrIuHRLmRzvd5wIRhY34Vf3Xjm6K2rHt9oAsGQMFuYUhsYM32fMgIKouX13gg3 eTFVFr6wUcbfbYYpTyT/U0elBQqPxNw93yfQvJtudhINpmcHdB5Qkxe4uvrq+o7Fqj7r 9yIQ== X-Gm-Message-State: APt69E1NPb6R+GyLGFveiyQQO+V0m6QsP5m22kqQb6QGmg4wPZSiZErb WWzExVtSYKQrKqSpKzxtEUm3E6MBs/Y= X-Google-Smtp-Source: ADUXVKIomte1BrR+M1Ox0nmDGukWmx6ha57mYZo8YxKiN02HtbKwdpW5asetVVk1xlsfGC1bVSd90w== X-Received: by 2002:a1c:7212:: with SMTP id n18-v6mr2007193wmc.5.1528533557061; Sat, 09 Jun 2018 01:39:17 -0700 (PDT) Received: from minerva.home ([90.77.100.34]) by smtp.gmail.com with ESMTPSA id k36-v6sm48863460wrc.20.2018.06.09.01.39.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 01:39:16 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Sakari Ailus , Javier Martinez Canillas , Mauro Carvalho Chehab , Laurent Pinchart , linux-media@vger.kernel.org Subject: [PATCH] media: omap3isp: zero-initialize the isp cam_xclk{a, b} initial data Date: Sat, 9 Jun 2018 10:39:12 +0200 Message-Id: <20180609083912.27807-1-javierm@redhat.com> X-Mailer: git-send-email 2.17.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The struct clk_init_data defined in isp_xclk_init() is a variable in the stack but it's not explicitly zero-initialized. Because of that, in some cases the data structure contains values that confuses the clk framework. For example if the flags member has the CLK_IS_CRITICAL bit set, the clk framework will wrongly prepare the clock on registration. This leads to the isp_xclk_prepare() callback to be called which in turn calls to the omap3isp_get() function that increments the isp device reference counter. Since this omap3isp_get() call is unexpected, this leads to an unbalanced omap3isp_get() call that prevents the requested IRQ to be later enabled, due the refcount not being 0 when the correct omap3isp_get() call happens. Fixes: 9b28ee3c9122 ("[media] omap3isp: Use the common clock framework") Signed-off-by: Javier Martinez Canillas Tested-by: Pavel Machek --- drivers/media/platform/omap3isp/isp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index f22cf351e3e..ae0ef8b241a 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -300,7 +300,7 @@ static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void *data) static int isp_xclk_init(struct isp_device *isp) { struct device_node *np = isp->dev->of_node; - struct clk_init_data init; + struct clk_init_data init = { 0 }; unsigned int i; for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i)