From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFD5AFA3744 for ; Mon, 31 Oct 2022 05:38:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229641AbiJaFiX (ORCPT ); Mon, 31 Oct 2022 01:38:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbiJaFiW (ORCPT ); Mon, 31 Oct 2022 01:38:22 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B214C00; Sun, 30 Oct 2022 22:38:22 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id 4so9864666pli.0; Sun, 30 Oct 2022 22:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/UHrfjKiovZQc+3fmk0jidTcvkQd82+qbKUFsraZYBE=; b=bUYKMiFON/+UE5LVAf6OaGkaCyF7WfivvqRu+3318rElHvQeGS7pRsYUSdXAxXW2rS +jx5o/Fk/rv4CH+zxbMrReDSYAdOPqi9FS+U56bJUJjkmRXioOQDuXeVPsutdfCIJk6v snQ9pG+qu2DBRRrEpzyJPChpPzEEFZb5h0KEKEmoQ9VKgIXD3ZVdE+1U/kaNN9RQAvln 3AOM3d2DZt8GlYJWEdwoiUc+oPJ66O4qh75FJT7N7PaExSPLz2TEtZjY/gx3oADQs/KS zPJIegCI1tmZHkqjCpAHVb9vQL4o9cMGYoC5toN7P7kH7+x7DAJ+VGxUQzaELJXN+9D+ +PDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/UHrfjKiovZQc+3fmk0jidTcvkQd82+qbKUFsraZYBE=; b=SSY78AUxGnLA4Qg1+z0Ne672zRPq+J64MB2LVUBH7umSVZSk+ei1WaNat7WGEaYpPE emVt93jjyRc24iwisnQliGvt35j/KwZnzdJVPeS7a7cgbTf6n9IdvGgZH7qP6If85qh/ UR+12GaJA3CE/YB6nqGKITDJ2kmvqf+9HBO4Lfvme0n0j+OQUD8rO+m0X+X8Do0kuDZy XfO9zCT82zXWaNmexCl/rxkCddNClem/PNx+pZK085xWODahdLT8Cc2QqOfKWjFAXkec ajvGXYbff1mZU7URj7pnPguN4vkr6Jk5jKXmn5Co4bpkbZ5YF3H9UY2MrgpADC/oOPjc ir7Q== X-Gm-Message-State: ACrzQf1w0A5JdvxiVIo766HAVto15LTe+K7po/PVJJ8jXsZxLZ0HhWNk C3UKqw6tRA3lLt8YqHNwj98= X-Google-Smtp-Source: AMsMyM6ECFSRrJ8RFE/9nnWqZ59bDZQk1HMdwHi++AgaN63UnU1jJiELqNrKBYXy0xwumLK2CNUtEQ== X-Received: by 2002:a17:902:f641:b0:17f:3633:5439 with SMTP id m1-20020a170902f64100b0017f36335439mr12865125plg.94.1667194700472; Sun, 30 Oct 2022 22:38:20 -0700 (PDT) Received: from google.com ([2620:15c:9d:2:a6ae:11ff:fe11:fcc3]) by smtp.gmail.com with ESMTPSA id j4-20020a170902c3c400b001754064ac31sm3517555plj.280.2022.10.30.22.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 22:38:19 -0700 (PDT) Date: Sun, 30 Oct 2022 22:38:16 -0700 From: Dmitry Torokhov To: Andy Shevchenko Cc: Lucas Tanure , "Rafael J . Wysocki" , Len Brown , Hans de Goede , Mark Gross , Liam Girdwood , Jaroslav Kysela , Mark Brown , Takashi Iwai , ALSA Development Mailing List , ACPI Devel Maling List , patches@opensource.cirrus.com, Platform Driver , Linux Kernel Mailing List Subject: Re: [PATCH v6 07/10] hda: cs35l41: Add support for CS35L41 in HDA systems Message-ID: References: <20211217115708.882525-1-tanureal@opensource.cirrus.com> <20211217115708.882525-8-tanureal@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Sorry for resurrecting old thread... On Thu, Jan 06, 2022 at 02:29:58PM +0200, Andy Shevchenko wrote: > On Fri, Dec 17, 2021 at 5:45 PM Lucas Tanure > wrote: > > > > Add support for CS35L41 using a new separated driver > > that can be used in all upcoming designs ... > > + /* No devm_ version as CLSA0100, in no_acpi_dsd case, can't use devm version */ > > Can you elaborate why devm can't be used? > > > + cs35l41->reset_gpio = fwnode_gpiod_get_index(&adev->fwnode, "reset", cs35l41->index, > > Please, do not dereference fwnode pointers. > Also, why can't you use the device instead of fwnode? We are doing "acpi_dev_put(adev);" a few lines above, so using adev in the call to fwnode_gpiod_get_index() is technically use-after-free, isn't it? Also, why can't we do cs35l41->reset_gpio = gpiod_get_index(acpi_dev, "reset", cs35l41->index, GPIOD_OUT_LOW); since acpi_dev is device structure corresponding to adev and we are getting the rest of the properties from it? I saw downthread that there was supposed to be a patch addressing several issues raised by Andy, was it ever submitted? Thanks. -- Dmitry From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BB3DFA3740 for ; Mon, 31 Oct 2022 05:39:24 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1DE4C1632; Mon, 31 Oct 2022 06:38:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1DE4C1632 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1667194762; bh=mqSblXv0mTqleQUiHj57WceC7m5j8D4qF/VjTxeN/5E=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DnZMlH7CJP4aZES+zPz+lHHQx6ziIg3ga6wVIFn8IUl1M4/L+7pOAxbymVTpkRlz1 n8SVXyW3RNltY+ggirTWr+hDl3yFTsB9rSTJsUq71Wp+BEUKkDBj4igc8d+o/gzSNI ABzsqHKixPndtbhRygFJid92OAlLh0PW97k1CZ2w= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A6425F8015B; Mon, 31 Oct 2022 06:38:31 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 43A4AF80163; Mon, 31 Oct 2022 06:38:30 +0100 (CET) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BD740F800E1 for ; Mon, 31 Oct 2022 06:38:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BD740F800E1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bUYKMiFO" Received: by mail-pj1-x1031.google.com with SMTP id u8-20020a17090a5e4800b002106dcdd4a0so14957299pji.1 for ; Sun, 30 Oct 2022 22:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/UHrfjKiovZQc+3fmk0jidTcvkQd82+qbKUFsraZYBE=; b=bUYKMiFON/+UE5LVAf6OaGkaCyF7WfivvqRu+3318rElHvQeGS7pRsYUSdXAxXW2rS +jx5o/Fk/rv4CH+zxbMrReDSYAdOPqi9FS+U56bJUJjkmRXioOQDuXeVPsutdfCIJk6v snQ9pG+qu2DBRRrEpzyJPChpPzEEFZb5h0KEKEmoQ9VKgIXD3ZVdE+1U/kaNN9RQAvln 3AOM3d2DZt8GlYJWEdwoiUc+oPJ66O4qh75FJT7N7PaExSPLz2TEtZjY/gx3oADQs/KS zPJIegCI1tmZHkqjCpAHVb9vQL4o9cMGYoC5toN7P7kH7+x7DAJ+VGxUQzaELJXN+9D+ +PDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/UHrfjKiovZQc+3fmk0jidTcvkQd82+qbKUFsraZYBE=; b=hwR0E335wrNAw8fLMuiIOfITvYD256lNPKUCFCMP6NNPE7HaQoVLX/vBuuwoeQUr2P f/5qeYpnWfaMZgevhjccMimt0ku1EOTcUh3Q3mD6lyuoQAKIPV31a18YdyfcFdJ6VusO S+2W5CujjDbQryiI3b7wpclhUhoOZZnc1gxwOPA/w9axtMJVStnVZDVEcAUblG5+qnun 7eYZfDWskXUnjYZjHU1K+z5dtOwOTewvbM6WOM/lDlnRw0pID0D586L0r+g5HC7nkKta gMwva/ToyJD80XQKyIKiLm90Jpibif0SO1roL/bf9LbZFDEVnJkOvo9CHyt6fOZCUqWH t2JA== X-Gm-Message-State: ACrzQf2IDY9cNbwY5ASRcwQ8WJuRtKS0a+aE8f7h20QfxxKs3Cf8PZbe ZoHgAyE8ic6eHoKX0cxmIVI= X-Google-Smtp-Source: AMsMyM6ECFSRrJ8RFE/9nnWqZ59bDZQk1HMdwHi++AgaN63UnU1jJiELqNrKBYXy0xwumLK2CNUtEQ== X-Received: by 2002:a17:902:f641:b0:17f:3633:5439 with SMTP id m1-20020a170902f64100b0017f36335439mr12865125plg.94.1667194700472; Sun, 30 Oct 2022 22:38:20 -0700 (PDT) Received: from google.com ([2620:15c:9d:2:a6ae:11ff:fe11:fcc3]) by smtp.gmail.com with ESMTPSA id j4-20020a170902c3c400b001754064ac31sm3517555plj.280.2022.10.30.22.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 22:38:19 -0700 (PDT) Date: Sun, 30 Oct 2022 22:38:16 -0700 From: Dmitry Torokhov To: Andy Shevchenko Subject: Re: [PATCH v6 07/10] hda: cs35l41: Add support for CS35L41 in HDA systems Message-ID: References: <20211217115708.882525-1-tanureal@opensource.cirrus.com> <20211217115708.882525-8-tanureal@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: ALSA Development Mailing List , ACPI Devel Maling List , Lucas Tanure , "Rafael J . Wysocki" , patches@opensource.cirrus.com, Takashi Iwai , Liam Girdwood , Mark Gross , Hans de Goede , Mark Brown , Platform Driver , Linux Kernel Mailing List , Len Brown X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Sorry for resurrecting old thread... On Thu, Jan 06, 2022 at 02:29:58PM +0200, Andy Shevchenko wrote: > On Fri, Dec 17, 2021 at 5:45 PM Lucas Tanure > wrote: > > > > Add support for CS35L41 using a new separated driver > > that can be used in all upcoming designs ... > > + /* No devm_ version as CLSA0100, in no_acpi_dsd case, can't use devm version */ > > Can you elaborate why devm can't be used? > > > + cs35l41->reset_gpio = fwnode_gpiod_get_index(&adev->fwnode, "reset", cs35l41->index, > > Please, do not dereference fwnode pointers. > Also, why can't you use the device instead of fwnode? We are doing "acpi_dev_put(adev);" a few lines above, so using adev in the call to fwnode_gpiod_get_index() is technically use-after-free, isn't it? Also, why can't we do cs35l41->reset_gpio = gpiod_get_index(acpi_dev, "reset", cs35l41->index, GPIOD_OUT_LOW); since acpi_dev is device structure corresponding to adev and we are getting the rest of the properties from it? I saw downthread that there was supposed to be a patch addressing several issues raised by Andy, was it ever submitted? Thanks. -- Dmitry