From patchwork Thu Apr 30 17:00:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Semen Protsenko X-Patchwork-Id: 466650 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 474931402B0 for ; Fri, 1 May 2015 03:02:27 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=globallogic.com header.i=@globallogic.com header.b=UCsp4p2c; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752345AbbD3RCZ (ORCPT ); Thu, 30 Apr 2015 13:02:25 -0400 Received: from exprod5og119.obsmtp.com ([64.18.0.189]:38143 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752161AbbD3RBu (ORCPT ); Thu, 30 Apr 2015 13:01:50 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]) (using TLSv1) by exprod5ob119.postini.com ([64.18.4.12]) with SMTP ID DSNKVUJf/Et05GeHvtKD5WQRZ/9VJ7LQgWjV@postini.com; Thu, 30 Apr 2015 10:01:50 PDT Received: by lbbqq2 with SMTP id qq2so49417394lbb.3 for ; Thu, 30 Apr 2015 10:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=globallogic.com; s=google; h=from:to:cc:subject:date:message-id; bh=wXyKxRP3JORg+xfSFAtx26nZuUxA5xUqa/cA62tbMG4=; b=UCsp4p2cRORGWE9oTv/Y003c4TSIjyZ3ps25UJeYUx6kKwn2P01Cu0ystP2gFLXj2n DA5qeuNNEap8J49hm/6iw+H3QAI7QDuXpO+TYwm+7MJ+7DGNi2JJYbPA9XdUS+Qt/BY6 bsx+5bTK8R1f9NQHLiFKfydtALcCVBjqkIeI4= 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=wXyKxRP3JORg+xfSFAtx26nZuUxA5xUqa/cA62tbMG4=; b=ZwFpDFu5IOPZpmF6g1EKU8Hgsgfu6y/Ftn3YDLwm/ODrbKwnmB9UpDuvhnP5EiYRv9 sjEihSxKwgQ18aSoOM07H05jPVxCroujQt3HXVFgZvi81u3G55YlcVXSPk9Wu6jrIKpM Srnpz+v6M5RwpzKFbmWk4GfmAZdN0xK4AZI1B7vtLockAcehLXg1JhAn3IvtodWYFyH9 FuyXdJmxEeXwn0McZBrM0FahzbfUv+iWBv2aHAP47RY8K2Q9gSurUGlWwTC9E20AwKmZ Bl5moyXQE86hKRtMYNq7efai6j7Qr6bK2BsvRxYbkcX8I1TZMLQVgN5spl7Q11IQbWv6 oLiA== X-Gm-Message-State: ALoCoQns7PBfC5ckqT1Eempf+Ghpgwt6AMFIs5R0+mnhqFZhS8K1EvLi2RL0Cz0oIpJiPvLcVhcpXPthBwfSYpG6rU/enrWOHXZqLnf0RVic/jp/EOtok04pS/lmvhtEzbvqt2Vs8+xbPqFIbreJF/1zN8g5O++/1Q== X-Received: by 10.152.5.194 with SMTP id u2mr4750088lau.3.1430413302844; Thu, 30 Apr 2015 10:01:42 -0700 (PDT) X-Received: by 10.152.5.194 with SMTP id u2mr4750072lau.3.1430413302754; Thu, 30 Apr 2015 10:01:42 -0700 (PDT) Received: from localhost ([195.238.92.132]) by mx.google.com with ESMTPSA id j10sm725465lbs.21.2015.04.30.10.01.42 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 Apr 2015 10:01:42 -0700 (PDT) From: Semen Protsenko To: Linus Walleij , Alexandre Courbot Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Grygorii Strashko Subject: [RESEND PATCH 1/3] gpio: max732x: Fix irq-events handler Date: Thu, 30 Apr 2015 20:00:36 +0300 Message-Id: <1430413238-9916-1-git-send-email-semen.protsenko@globallogic.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org MAX732X clears all pending interrupts on I2C read (when interrupts register is being read). Driver doesn't need to send any ACKs when interrupt was handled. So replace handle_edge_irq() with handle_simple_irq(). Using handle_edge_irq() (w/o .irq_ack callback set) may lead to NULL pointer dereference in some cases. E.g. this was observed on hibernation process: Unable to handle kernel NULL pointer dereference at virtual address 0 Backtrace: (handle_edge_irq) from (resend_irqs) (resend_irqs) from (tasklet_action) (tasklet_action) from (__do_softirq) (__do_softirq) from (run_ksoftirqd) (run_ksoftirqd) from (smpboot_thread_fn) (smpboot_thread_fn) from (kthread) (kthread) from (ret_from_fork) Signed-off-by: Semen Protsenko Reviewed-by: Grygorii Strashko --- drivers/gpio/gpio-max732x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c index 0fa4543..7b6fb68 100644 --- a/drivers/gpio/gpio-max732x.c +++ b/drivers/gpio/gpio-max732x.c @@ -521,7 +521,7 @@ static int max732x_irq_setup(struct max732x_chip *chip, ret = gpiochip_irqchip_add(&chip->gpio_chip, &max732x_irq_chip, irq_base, - handle_edge_irq, + handle_simple_irq, IRQ_TYPE_NONE); if (ret) { dev_err(&client->dev,