Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4209779imw; Tue, 19 Jul 2022 01:58:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u7vPmgr4vh76P5X0O75HkhGpB92YKoQqVDCzFmtUDuEkqQ7sm1vBz4J5p5zDADgrfNbRnG X-Received: by 2002:a17:907:75d9:b0:72b:1472:ba19 with SMTP id jl25-20020a17090775d900b0072b1472ba19mr28832545ejc.657.1658221104805; Tue, 19 Jul 2022 01:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658221104; cv=none; d=google.com; s=arc-20160816; b=tG3skZhv/5EfzFPIpohyZ8rBeiS+/BERfJYmhVotx82PXqSFRQCZJ76rRTheUYCazK HXM0x9pp/JYxSfo4mLO9khZvEKfNmgupiwAjPub2F3ogSXLUUMKdVtIE0ZacPprGKrN3 s5av4zyXfxFfgAz1i67ALfNJXw7D+aNKQapoqJX71XF7BaIMjzJvUnadLf/KOrs8Tx+b kqhfVsX2DinYagPcKdSccKVNmK65mIv+8AHiG1Vb1OzKD1YyR66Z8fBSEbKVP6MWnarW no9vlPQzJu89lERm7v6V//4etkzfoL4MAZlFeasjaIE1Q9Cw560WGXi0fqKCNGfX7mLJ fwAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=tR0/VVyCAljncCmG1wER9xgYFrm6Y6iCZuLwe6BpOEg=; b=0Xdsl8jokH9Do0tO/T5dpqxYVQDGNKsvo1Ty5Pki5NeBPKSTDgUPScbeMVDzzWWOH9 TAWAeecEXzb3SSBTj6lxQynrjZZWfVRmS0wAZNKkyblU04SP0a1Z8JTjfxEbrsTNP//u vbKMbHKcbIo9h2EDQCUPA/9RwiqT9OC9TnYOghOIxjA2/AoQSN2cmH4G2xxSSnslOiam mfjxv30Xbpw+n0pRg6TGBQL0cFt3EbK06W0Iep6G9b2KAX+D+e8bpMRFuV0HocPYvqJF mcCYkSgXxlY8RBZ6oXaPakv9MlquzbUvQ0kET7l1bspv4THMus47syhTFTBSSs0ZoOYc 61Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KLFIrmnj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk31-20020a1709077f9f00b006fed9affed0si23570110ejc.528.2022.07.19.01.58.00; Tue, 19 Jul 2022 01:58:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KLFIrmnj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232969AbiGSIdQ (ORCPT + 99 others); Tue, 19 Jul 2022 04:33:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236524AbiGSIdO (ORCPT ); Tue, 19 Jul 2022 04:33:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F18730F57; Tue, 19 Jul 2022 01:33:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 382EB61784; Tue, 19 Jul 2022 08:33:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7DA8C341C6; Tue, 19 Jul 2022 08:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658219592; bh=z1LzE70cPNQsqpra2mY+nHzyu/ROdNvbnYE3LasHjb8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KLFIrmnjnTZrtjEgjsVQj4d6RtyGAIa2+Z1oQ/4UQVXumayhm2ITQRwg9IRFMg1TK b1OtQNIGACk/AFh9Ebsw8K5tlVrK2h3x4yA6K7tsBfMQ77+9BGTEem2BkoIOzNt8dR ztIbzWeFZTOk3heCZT/K7LFe7rB78mWsEFxYOd9luKnvxYJofA7xOQ+F6lxVICkw1v CRsgasaFfOvMMFPl8lTc+kLiL/m3pi7rP2Ww1LsOJMgGavYVZNMeHxeB97S7etjqPf 5OvgJTm4Hh9XvA3/r7N1OLBFeO0gz6opfNbfV2BhZ5a3w3cUapa8scAzmR5CyjPA2T 0sAipM1LsqEjw== Date: Tue, 19 Jul 2022 09:43:09 +0100 From: Jonathan Cameron To: Zheyu Ma Cc: lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] iio: light: isl29028: Fix the warning in isl29028_remove() Message-ID: <20220719094309.4811f385@jic23-huawei> In-Reply-To: <20220717004241.2281028-1-zheyuma97@gmail.com> References: <20220717004241.2281028-1-zheyuma97@gmail.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 17 Jul 2022 08:42:41 +0800 Zheyu Ma wrote: > The driver use the non-managed form of the register function in > isl29028_remove(). To keep the release order as mirroring the ordering > in probe, the driver should use non-managed form in probe, too. > > The following log reveals it: > > [ 32.374955] isl29028 0-0010: remove > [ 32.376861] general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1] PREEMPT SMP KASAN PTI > [ 32.377676] KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037] > [ 32.379432] RIP: 0010:kernfs_find_and_get_ns+0x28/0xe0 > [ 32.385461] Call Trace: > [ 32.385807] sysfs_unmerge_group+0x59/0x110 > [ 32.386110] dpm_sysfs_remove+0x58/0xc0 > [ 32.386391] device_del+0x296/0xe50 > [ 32.386959] cdev_device_del+0x1d/0xd0 > [ 32.387231] devm_iio_device_unreg+0x27/0xb0 > [ 32.387542] devres_release_group+0x319/0x3d0 > [ 32.388162] i2c_device_remove+0x93/0x1f0 > > Fixes: 2db5054ac28d ("staging: iio: isl29028: add runtime power management support") > Signed-off-by: Zheyu Ma As I'm doing one last pull request before the merge window, I've applied this to the togreg branch of iio.git and marked it for stable. Thanks, Jonathan > --- > Changes in v2: > - Use the non-managed form to register the device > --- > drivers/iio/light/isl29028.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c > index 9de3262aa688..a62787f5d5e7 100644 > --- a/drivers/iio/light/isl29028.c > +++ b/drivers/iio/light/isl29028.c > @@ -625,7 +625,7 @@ static int isl29028_probe(struct i2c_client *client, > ISL29028_POWER_OFF_DELAY_MS); > pm_runtime_use_autosuspend(&client->dev); > > - ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); > + ret = iio_device_register(indio_dev); > if (ret < 0) { > dev_err(&client->dev, > "%s(): iio registration failed with error %d\n",