Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp196979pxv; Thu, 8 Jul 2021 00:04:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2NkSoZq0WiJ6ZhnRR0LuT0uOZbFeBeKkxLvVZ1+/3GKobKVaS5RCnlNksEXxGfS6Ndkey X-Received: by 2002:a05:6e02:47:: with SMTP id i7mr21774516ilr.35.1625727899743; Thu, 08 Jul 2021 00:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625727899; cv=none; d=google.com; s=arc-20160816; b=cXoC8hJHgbyOaJHcIEchjD3wZ8Whn+XsnhqQQ8vJE9UZYz99KsN9xJO+k2XKSehliR UbM5WONBLa0SLV+DG8iMTQnHo19SkBoRUtB83TJcw7F/ssJvCLuEbe/EE2ijE0SvYSYm fQQ4yTf/bkD5cGfVee9TXEO2CaFLY7UIpMnKqf4P1TcinT7PtTjPPMRHEIJPpMB/Mh7f /wo3T1o6/6/+3L/ig+MdnjTfmtV1ImcQc5ldBT2ncGTXK8lXqt4B6QA8ZntH7/eudSSA 7kGt35+V7Fm/BkAS0UyOWkVkr+SzZxhZHQLL9J3cRvqorIJSwipuFyPTOvY4k8VeAvQ4 mcVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AolFQ0Dlxnk8mpgwdaTbhkpjw+QyQ2x2z2tLBCeVDKU=; b=flg+ep55UORNI6JNchMmWP/sWRcuM7srrl+iS09sqsy9nXN8c1iRLiMIRVgywFJAJ1 3OuKAYP8MhsVzxtGT3txuCLp6LnAmL7+Ct3V+b9KqCLe8JCe8iyxlPHyZRTJ0JJP59iz F7IhbBrJ7Jk2yHHe6kQnaxjpGgquoNIkuKzsigVauoW1MuVKfCwMsF0lEfYK6VEN2NEN hoXuOawuA7E1Bn0i98iFPyXqSrGdX2bEqReQfoBTfYhd+SF8vVXSJFC7+I8WHe1KdzqD YqgaIw0u3uTNBbUn5q5ZEC3JKtjpuPqOspQ/cZw+Z5EuisC/7d/yojisx+CZJcbApupD goJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=JSMx6oJe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si1599597jat.32.2021.07.08.00.04.44; Thu, 08 Jul 2021 00:04:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=JSMx6oJe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229842AbhGHHGG (ORCPT + 99 others); Thu, 8 Jul 2021 03:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbhGHHGG (ORCPT ); Thu, 8 Jul 2021 03:06:06 -0400 Received: from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com [IPv6:2607:f8b0:4864:20::a29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D7D1C061574 for ; Thu, 8 Jul 2021 00:03:24 -0700 (PDT) Received: by mail-vk1-xa29.google.com with SMTP id d7so1172118vkf.2 for ; Thu, 08 Jul 2021 00:03:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deviqon.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AolFQ0Dlxnk8mpgwdaTbhkpjw+QyQ2x2z2tLBCeVDKU=; b=JSMx6oJewQlDXLoMI+Mk4yW+QG4e1/UHJT/MSmzqWBGYemY4kSFSWJh+qidXXAdyHG kk9h0cAuJ6wv7+WaChvXuvoq86cYFE3wEydjQvuvVgb0rbX84QDOepMZOgqyrKqGjV/y w9gQnySkQqXzQQExenmtsUjkil9v/Lk1X0h4Yc2XtAmlY6js9sY47XYQtiEi3ktSsgDT /4w1UPgQ8098XZVN6BY6m/o1KfMiplAyD8LeyFMlM8WnalFyliR0kRleW22rJaAQap7O aW3hlFM2i1cQ2FGjExmVEbp7IoESM9wcNX7+co2P91XUskUvWjlAlSVez0+bHkxAL04J dApw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AolFQ0Dlxnk8mpgwdaTbhkpjw+QyQ2x2z2tLBCeVDKU=; b=pQhLkIfF4pfZbqAI8x50F4D3054xo7wesvBCILR20L8i//VUglNgUlbabddg04CwZz i+Fza/o5+EK4jEU5ZdP0drukhmrwpHpTRY+RiBPME/ohOtCQNNAmAgUA+9bjuV5WuEtq nUQJsdJU/tLGagruoWaEMnwfyClj8S6eZFAI9lg1tynivXNhYdoK6Ya2b5Mp0I3ESjAl wufqwQd0mB6Mtaf+9xdqpl4cDKFTJZQ7KcTA8qxLl+IrSoc6NeuJUO3nM+4WWsLYNKl/ qDL0dfQVWgO6naxcPh8aYceFPp1DcnZwVTfupbzsHYbe7M737YqmUWpt1Q4l3JYbWB8q E5mw== X-Gm-Message-State: AOAM5334Rxpv4ZGxI5J2eIJTmOFeM3mj4GHbVhU9H2S613QRkd7HX5bu 57lQ7eIbCDF7UesMb2y77tuQyr/daZDeVDbiGxenHg== X-Received: by 2002:a1f:6247:: with SMTP id w68mr7602824vkb.11.1625727803200; Thu, 08 Jul 2021 00:03:23 -0700 (PDT) MIME-Version: 1.0 References: <20210707135226.191988-1-aardelean@deviqon.com> In-Reply-To: From: Alexandru Ardelean Date: Thu, 8 Jul 2021 10:03:12 +0300 Message-ID: Subject: Re: [PATCH] gpio: wcove: remove platform_set_drvdata() + cleanup probe To: Andy Shevchenko Cc: linux-gpio , Linux Kernel Mailing List , Bartosz Golaszewski , Linus Walleij , sathyanarayanan.kuppuswamy@linux.intel.com, andy@kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 7 Jul 2021 at 17:09, Andy Shevchenko wrote: > > On Wed, Jul 07, 2021 at 04:52:26PM +0300, Alexandru Ardelean wrote: > > The platform_set_drvdata() call is only useful if we need to retrieve back > > the private information. > > Since the driver doesn't do that, it's not useful to have it. > > This is fine. > > > This change also changes the probe order a bit, moving the > > devm_gpiochip_add_data() as the last call. This means that when the > > gpiochip is registered [and available to consumers], it should be > > initialized. > > > > It's still possible that the devm_gpiochip_add_data() call could fail, > > leaving the chip in a partially initialized state, but that was possible > > even before this change; it was just some other partially initialized > > state. > > ... > > > /* Enable GPIO0 interrupts */ > > ^^^^^ > > > + return devm_gpiochip_add_data(dev, &wg->chip, wg); > > This is dangerous change. How did you test it? > > The handler now can be called before chip and actual handling code is > registered. It means at least two possible (bad) scenarios: > 1) the handler may dereference dangling or NULL pointer; > 2) the IRQ may be level interrupt and we may got 100000 IRQs and > IRQ core will disable it leaving device completely unfunctional. Makes sense. Let's drop this :) > > -- > With Best Regards, > Andy Shevchenko > >