Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp3964217pjo; Tue, 3 Mar 2020 10:11:17 -0800 (PST) X-Google-Smtp-Source: ADFU+vv0ec2Exbz4RzVejQiy5nQGvhZv2LOa5N8aRr/dFru2jbB1/hW722OGQijcfELUVs6zJK2X X-Received: by 2002:a05:6808:98e:: with SMTP id a14mr3172463oic.8.1583259076952; Tue, 03 Mar 2020 10:11:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583259076; cv=none; d=google.com; s=arc-20160816; b=R6gpD8HKtWZmcUCZOhmESoc/+FHn/nQKe25/EEk71NY/bJ+XBsTChu7MUu4DVHdKDE vbdxaogCRU/9ziDzC2rjq9gbQviy9Z1SzIPClab/O9FMxxGBdVDN5SyXPOEajBAECjyS CfvxnjPIRj33/m3mYlXtUSEyjxsklOsLKtVUt+/nj7yIGYJ/IQhF6BIrDSlV/B5gAsPA 44s0f3za9DKqlU9AQhIFKc1B1paZuJHfnLfEyliKXXtJbY+DoYkCPHcQI/BHA71EX+Y/ yG6m31KiTvHzYELFc6rZNWMS7tMkQ0wfEzV5I7G3M2UIieL66DJVaM7f9HhjmMEb68T7 bEQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MCUic/VJo3nQQcoMZS8hbD3y0b8e3ZDn5v9iYQT5Yfo=; b=n/Peh0f4uNNc176/NcmdESZLds93w+rXAS4ioLJ50SUyQlIYqQVEF9LBJyJJvM10m0 GaluhOsbiI6mlw2uxiQMHrwLP2qd8MthEi2NfursSNueY52GHe5RWvLpd3eNhWQ3+BIZ i6o/uwsR/920lf64Er1AN0MF6WY+zP5wFqECNGjhewcTBxjuyEqhuMtRbIKjNpIdD/i8 BpdImzlEssDZye8fHnp/GaoB9mwOaVj8FI0ame59ozNRpd6i1vf3exaajyB/lG3krQOh Gw2jRzX3N/ohE9/GTwi1TCfCdfQuyHMZ7sjDcppJMAuN/Da4PXQYOW045rDdTFsnHoSC 62uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MjcfAR2K; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si7761601oic.153.2020.03.03.10.11.04; Tue, 03 Mar 2020 10:11:16 -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=MjcfAR2K; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731604AbgCCRuw (ORCPT + 99 others); Tue, 3 Mar 2020 12:50:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:58712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731599AbgCCRut (ORCPT ); Tue, 3 Mar 2020 12:50:49 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 D5F54206D5; Tue, 3 Mar 2020 17:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583257849; bh=4fp9qbx9F3oLx3ltw+sBpkPbmOlFmAruNUKBp51xmhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MjcfAR2KwrVKcf18u8/+TDeLAJBd0F+navKZP4Z2UTSAHi4iiOg6H8MKyN1V14JFM JoEgeifeS2z0adVUFIcrjRvvZjE6aXXBMzV2ovNbaKHgg12CtVlh+jPvXnu/cv3KXI EUNt2auvGpEBxUuexvM2vQvTcoHt2VGhvGLmDzME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Elfring , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Thierry Reding Subject: [PATCH 5.5 152/176] pwm: omap-dmtimer: put_device() after of_find_device_by_node() Date: Tue, 3 Mar 2020 18:43:36 +0100 Message-Id: <20200303174322.184115425@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174304.593872177@linuxfoundation.org> References: <20200303174304.593872177@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-König commit c7cb3a1dd53f63c64fb2b567d0be130b92a44d91 upstream. This was found by coccicheck: drivers/pwm/pwm-omap-dmtimer.c:304:2-8: ERROR: missing put_device; call of_find_device_by_node on line 255, but without a corresponding object release within this function. Reported-by: Markus Elfring Fixes: 6604c6556db9 ("pwm: Add PWM driver for OMAP using dual-mode timers") Signed-off-by: Uwe Kleine-König Signed-off-by: Thierry Reding Signed-off-by: Greg Kroah-Hartman --- drivers/pwm/pwm-omap-dmtimer.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -256,7 +256,7 @@ static int pwm_omap_dmtimer_probe(struct if (!timer_pdev) { dev_err(&pdev->dev, "Unable to find Timer pdev\n"); ret = -ENODEV; - goto put; + goto err_find_timer_pdev; } timer_pdata = dev_get_platdata(&timer_pdev->dev); @@ -264,7 +264,7 @@ static int pwm_omap_dmtimer_probe(struct dev_dbg(&pdev->dev, "dmtimer pdata structure NULL, deferring probe\n"); ret = -EPROBE_DEFER; - goto put; + goto err_platdata; } pdata = timer_pdata->timer_ops; @@ -283,19 +283,19 @@ static int pwm_omap_dmtimer_probe(struct !pdata->write_counter) { dev_err(&pdev->dev, "Incomplete dmtimer pdata structure\n"); ret = -EINVAL; - goto put; + goto err_platdata; } if (!of_get_property(timer, "ti,timer-pwm", NULL)) { dev_err(&pdev->dev, "Missing ti,timer-pwm capability\n"); ret = -ENODEV; - goto put; + goto err_timer_property; } dm_timer = pdata->request_by_node(timer); if (!dm_timer) { ret = -EPROBE_DEFER; - goto put; + goto err_request_timer; } omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL); @@ -352,7 +352,14 @@ err_pwmchip_add: err_alloc_omap: pdata->free(dm_timer); -put: +err_request_timer: + +err_timer_property: +err_platdata: + + put_device(&timer_pdev->dev); +err_find_timer_pdev: + of_node_put(timer); return ret; @@ -372,6 +379,8 @@ static int pwm_omap_dmtimer_remove(struc omap->pdata->free(omap->dm_timer); + put_device(&omap->dm_timer_pdev->dev); + mutex_destroy(&omap->mutex); return 0;