From patchwork Tue Oct 29 04:57:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 3106181 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 31BA9BF924 for ; Tue, 29 Oct 2013 04:59:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 583102034A for ; Tue, 29 Oct 2013 04:59:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 87AC920328 for ; Tue, 29 Oct 2013 04:59:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751230Ab3J2E7D (ORCPT ); Tue, 29 Oct 2013 00:59:03 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:47938 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751162Ab3J2E7D (ORCPT ); Tue, 29 Oct 2013 00:59:03 -0400 Received: by mail-pa0-f52.google.com with SMTP id bj1so2069781pad.11 for ; Mon, 28 Oct 2013 21:59:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=19dHUhq/pSMpLoPbJshJfzQP35/iDdr1oWaRGRJy4l0=; b=kqtXxZgbwMF3aTqVkMt8QdD36Ku5BZFvD3O7WqMVHbPcnYf/tobQ6aWNVcJDMy9NnC 28hn304eGEQg/TJCXLrs6tvMQLOKkv2+Jo35uHxeszDEpC+Hg1egU9v6BOnvoNzbVKwh Bt4q06kn8KTDRlPOF4hXMlNcVYKiYTkB70lp3ZlED/6I63Ch31EatXM9fHCf+ck1Oe9G GfbrsOP20kan5Q7zNjlmipy2WyzvOkt/W9Fo7ktx6CvXwlAccWh2RH/e4csfsu0RX9oO 1ARViulK1GTIQ1evcvN5+RcBBVp58MyuO6x2PS7Y5cZO0oCYHtIMEjrsmqkDkZRMUixV J0bg== X-Gm-Message-State: ALoCoQljBL6XxkqpA6Lr9nlc2Wi4kwEBEYcQDoLJESRoW4pdtvGaiCVek0YG5b3pksJ6ZHDIl9YF X-Received: by 10.68.197.1 with SMTP id iq1mr9787708pbc.131.1383022741882; Mon, 28 Oct 2013 21:59:01 -0700 (PDT) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id hu10sm32391264pbc.11.2013.10.28.21.58.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Oct 2013 21:59:01 -0700 (PDT) From: Sachin Kamat To: linux-pwm@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org, thierry.reding@gmail.com, tomasz.figa@gmail.com, sachin.kamat@linaro.org Subject: [PATCH 1/1] pwm: samsung: Fix kernel warning while unexporting a channel Date: Tue, 29 Oct 2013 10:27:43 +0530 Message-Id: <1383022663-22315-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PWM channel data was set to NULL before freeing it. This caused the following kernel warning while unexporting the channel. Set the channel data to NULL after freeing it. [ 70.495000] WARNING: CPU: 0 PID: 1 at drivers/base/devres.c:805 pwm_put+0x48/0x80() [ 70.505000] Modules linked in: [ 70.505000] CPU: 0 PID: 1 Comm: sh Not tainted 3.12.0-rc6-next-20131024-00012-gd4aec04-dirty #58 [ 70.515000] [] (unwind_backtrace+0x0/0xf4) from [] (show_stack+0x10/0x14) [ 70.525000] [] (show_stack+0x10/0x14) from [] (dump_stack+0x7c/0xb0) [ 70.530000] [] (dump_stack+0x7c/0xb0) from [] (warn_slowpath_common+0x6c/0x88) [ 70.540000] [] (warn_slowpath_common+0x6c/0x88) from [] (warn_slowpath_null+0x1c/0x24) [ 70.550000] [] (warn_slowpath_null+0x1c/0x24) from [] (pwm_put+0x48/0x80) [ 70.560000] [] (pwm_put+0x48/0x80) from [] (pwm_unexport_store+0x94/0xac) [ 70.565000] [] (pwm_unexport_store+0x94/0xac) from [] (sysfs_write_file+0x148/0x1d8) [ 70.575000] [] (sysfs_write_file+0x148/0x1d8) from [] (vfs_write+0xb4/0x1a0) [ 70.585000] [] (vfs_write+0xb4/0x1a0) from [] (SyS_write+0x3c/0x78) [ 70.595000] [] (SyS_write+0x3c/0x78) from [] (ret_fast_syscall+0x0/0x30) Signed-off-by: Sachin Kamat Reviewed-by: Jingoo Han --- drivers/pwm/pwm-samsung.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c index b2c54c8..6d23eb3 100644 --- a/drivers/pwm/pwm-samsung.c +++ b/drivers/pwm/pwm-samsung.c @@ -226,8 +226,8 @@ static int pwm_samsung_request(struct pwm_chip *chip, struct pwm_device *pwm) static void pwm_samsung_free(struct pwm_chip *chip, struct pwm_device *pwm) { - pwm_set_chip_data(pwm, NULL); devm_kfree(chip->dev, pwm_get_chip_data(pwm)); + pwm_set_chip_data(pwm, NULL); } static int pwm_samsung_enable(struct pwm_chip *chip, struct pwm_device *pwm)