Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5585902pxv; Wed, 7 Jul 2021 07:13:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPQfj58btOtWbZLcAJ5Ph0Ij6l8AEorXh4m9yvfxhkM5Ubc4MyefBmV01tNLAaP7qWlrbd X-Received: by 2002:a50:ee87:: with SMTP id f7mr8390336edr.155.1625667180405; Wed, 07 Jul 2021 07:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625667180; cv=none; d=google.com; s=arc-20160816; b=iSsWc+3t/3kaza0utr+rsVJRBfQd8iJjEW+1FKcFz4/DTNcm5RJob62drsWR4AYoY1 SuvoT+j2wj6Q+sd9t13NsFfmYldNp34jXhbjTyazmfC6kOq4SuBuYcWVFcZc023cybf0 vRz8pXGnHIqy6iL13iHfIXfAgr93aJRMttRR0MiTlW5pddcDCMaROHhE1+5f447q8IE/ Z+ycQOvGcRocc0ooUcJirAv7xO3uy8rJShPZe7HkXNy/EojSbDL6n5S+q8A0hHBqhkQo lCv0KfWtR3ugCwKtLFBq9bApI2jOAtUMuaRbkQnosVtMWhPqHBLx81SaXwg0zeCi7gMc 30Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=1t9tHQSEsGDpgY0KRMzMj37c5nzCoxrFjpDJsoy5HUM=; b=h0oQs4B59e1M5wC0JZzTFnunephYlgsvoGmIrNiqSY8Pylkhl7LKNQ+FRSI9uLJLjF NgpkF2iiTvZpIccpu8w4DrKLgoJd1IjHzIyXK3nKt/i2UZm7nxz7zAErIeavsfYFSqTX UDolau+G/UyUPWZa07NBiXEcB9pjSA3Nth9HJ1xrR1d7Z6W6YINrrbTyBQ1AY+0uESXb QuqZbsLTWkH6Uca1qop2pfmgRBOABHoanIb0dVXzq0DztJO8f+mK3i4LOpsm1igY9OM5 ylHOXeUICkmUhBlCrhco68fXYQfgcM8UQLMClZ1luwqSkYLrf0/IGmHWfXYSQruPThvt N15w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m4si18425987eja.301.2021.07.07.07.12.34; Wed, 07 Jul 2021 07:13:00 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231785AbhGGOLk (ORCPT + 99 others); Wed, 7 Jul 2021 10:11:40 -0400 Received: from mga01.intel.com ([192.55.52.88]:36218 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231472AbhGGOLj (ORCPT ); Wed, 7 Jul 2021 10:11:39 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10037"; a="231049368" X-IronPort-AV: E=Sophos;i="5.83,331,1616482800"; d="scan'208";a="231049368" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2021 07:08:59 -0700 X-IronPort-AV: E=Sophos;i="5.83,331,1616482800"; d="scan'208";a="427950393" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2021 07:08:57 -0700 Received: from andy by smile with local (Exim 4.94.2) (envelope-from ) id 1m18EO-009pXG-5J; Wed, 07 Jul 2021 17:08:52 +0300 Date: Wed, 7 Jul 2021 17:08:52 +0300 From: Andy Shevchenko To: Alexandru Ardelean Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, bgolaszewski@baylibre.com, linus.walleij@linaro.org, sathyanarayanan.kuppuswamy@linux.intel.com, andy@kernel.org Subject: Re: [PATCH] gpio: wcove: remove platform_set_drvdata() + cleanup probe Message-ID: References: <20210707135226.191988-1-aardelean@deviqon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210707135226.191988-1-aardelean@deviqon.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- With Best Regards, Andy Shevchenko