Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8284602rwb; Tue, 13 Dec 2022 04:42:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf4BhxQguUfIX8ZcfMMkhMzV+2nsuqzy4fGdA9o4txzMDABSDbZLPefrkxsAXAHiZgAI9L7R X-Received: by 2002:a17:906:55d5:b0:7c1:f64:61f1 with SMTP id z21-20020a17090655d500b007c10f6461f1mr15200407ejp.45.1670935329655; Tue, 13 Dec 2022 04:42:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670935329; cv=none; d=google.com; s=arc-20160816; b=mwS3WY9odpRtL81oVKPS98Vg9MF8sxpGI8R2qMr8TGW7zsGIMUhWJ9jq1FNdM4KYq2 L5qgwK2HGIRtnyUbOZaHgvZH94SVR5S3/ZBar8Ml44vDkRtBuFvWtPndbhwYI3awCWno JwE+8po/c8ouQN42VInL2WWYZrl0Icy63PskqnpEqOCPNoix6K8sCF3lsMl59rLL/htf fUyz+pLg/BYkhNQUeTmOTAyg5HwVDDjWtMbA7/QUySgFYDIQ/mbd1TT3MHYdeCbiCQ2u K4z3TxJXlRcAYe93CSbUMFvNwUKM8KSSylETAuXVA9XNsV0RNv3qrDOypM3pd6Qr/7I1 tCJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jKBqZEw0xUCt+yQgYVOpQvlkPfdPfWQi25lu10p/rvg=; b=Kgoy1V4f7ZqKUP3tXio3KD//cEaRBLWDZzqNPGedSEqBoHBEJszD3iXhHU379vmZtj pOP8Vjk4uMDcdUc/igAVetrFEXdgrmTJfMWgwfOSmbLH0NWwIlTmqaSyWsZ8yVzVlq7o TUmuXtwuFxIl3IbFOHCe08W8iEktlv7ApuWUpNtUEOKJ/Ki5xQiVJlgDQKJ04Mcco5kr OAmBG7c+BkQRI2iN2+hHeyZe3edTVMLWZF6FLIgz4HtvznMxvwIxFqQimVy1vNIAzm2L gfDnsc5CfCOZMM9aNcZK6E3ROLWfvPIHykZfPhAG+p98gaFS6kjGZ8d+HfGdH21lk65+ nlhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="AJF9gQ/C"; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm22-20020a170907949600b007ae9bc0b977si421255ejc.486.2022.12.13.04.41.51; Tue, 13 Dec 2022 04:42:09 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b="AJF9gQ/C"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235363AbiLMMEK (ORCPT + 74 others); Tue, 13 Dec 2022 07:04:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231421AbiLMMEI (ORCPT ); Tue, 13 Dec 2022 07:04:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 517DF95B4; Tue, 13 Dec 2022 04:04:06 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 021C5B8118F; Tue, 13 Dec 2022 12:04:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BA37C433D2; Tue, 13 Dec 2022 12:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1670933043; bh=2x5Rdsw1M8e0Qb/YdxOUP82YSl/lHC9ENmG7g7vL4Yg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AJF9gQ/CVJbCPRBsniDEQ7uo5qx582Uf1XMdG9R6uV1icLDGLZ+X1mHVmXRAIk6A0 MeiCykyD3phyVc24DLpVzdLZ+lbxClr6vd82sUI+hjZTkk/t4LeL9MIEUjwDklMNwu dwQm4WRYmycnUEz9IgP/79AR+8DFAMn75v1cyG/Q= Date: Tue, 13 Dec 2022 13:04:00 +0100 From: Greg KH To: Jishnu Prakash Cc: agross@kernel.org, bjorn.andersson@linaro.org, devicetree@vger.kernel.org, robh+dt@kernel.org, linus.walleij@linaro.org, quic_kamalw@quicinc.com, quic_jestar@quicinc.com, sboyd@kernel.org, quic_subbaram@quicinc.com, quic_collinsd@quicinc.com, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-msm-owner@vger.kernel.org Subject: Re: [PATCH] spmi: Add check for remove callback in spmi_drv_remove API Message-ID: References: <1670145780-13111-1-git-send-email-quic_jprakash@quicinc.com> <1670145780-13111-2-git-send-email-quic_jprakash@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1670145780-13111-2-git-send-email-quic_jprakash@quicinc.com> X-Spam-Status: No, score=-7.1 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, Dec 04, 2022 at 02:53:00PM +0530, Jishnu Prakash wrote: > Add a check for remove callback presence before calling it for a > spmi driver, to avoid NULL pointer dereference error if remove callback > has not been specified for that SPMI driver. > > Signed-off-by: Jishnu Prakash > --- > drivers/spmi/spmi.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c > index a456ce5..6b34356 100644 > --- a/drivers/spmi/spmi.c > +++ b/drivers/spmi/spmi.c > @@ -350,7 +350,8 @@ static void spmi_drv_remove(struct device *dev) > const struct spmi_driver *sdrv = to_spmi_driver(dev->driver); > > pm_runtime_get_sync(dev); > - sdrv->remove(to_spmi_device(dev)); > + if (sdrv->remove) > + sdrv->remove(to_spmi_device(dev)); > pm_runtime_put_noidle(dev); > > pm_runtime_disable(dev); What in-kernel spmi driver does not have a remove function set that requires this change? thanks, greg k-h