Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4466013rwb; Sun, 4 Dec 2022 02:32:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf6FpCkTrf7AteJfIFxsTS45CjmgZpaXiUjMkCJJOfxGdCIq3qIZouzhTZ9Qk48t7Is66t2A X-Received: by 2002:a63:e907:0:b0:477:5e25:baf4 with SMTP id i7-20020a63e907000000b004775e25baf4mr58377502pgh.544.1670149956333; Sun, 04 Dec 2022 02:32:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670149956; cv=none; d=google.com; s=arc-20160816; b=yJiwoMSstPcYThK/OE9IAV9ockVh4YR5YJsA3Q+nFgx3VikjKpfVAg8aNsL14GF92l ZGcJ5X1WDvy+OZnfgTP2eptfQ+r9LGCCTMokvZLk61gAY4V8LdbRfDAE7BGoiH89LSsC /6JUHywhClJi5Tf8xacBsIIWipqSr28SQidRFCgMIgMk5p7ZotQRSGEf+e7gGCUY9iEp N+L+m48SKXb7LmzY4VVN5/dOXkINlh95saGF1ipz6YUa6ZZxMLyMZ/qqEL6TsbAAW7IB xhzJZsx6zAL4jXbbrEYZtP6Y1QIvWDRiv8ddUp1B3uoI4ATwF35lWrQTmCBj8rRtAQI3 AM5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wnv+eALC//9uYoKqfbEwGHq0ODkglh3YfZ+e98rMwq8=; b=KCdWeMpzCzSuz7sQeoPi5mcTF06UMVJcwuLl7QWqS6g+65stPQnomNmZInI5WS63JT 5GQIpgzeUI2vhgPSGU6dSiRQg2PwWevw/c4LApBn9kKEX8wlgh8MzmzYEs8fqaZOCxWY ee5rrHp3vTL1VJ2izXi0vER+LLeI2DTIJ/vtiMeEKAsj5yXPLv9mXRKuIZ4j2zJQgpzS E7T+h3Qv4/ryVJM1s5Uw78NmYo2qZEeUyvQKwFVA7Nye96NlfbDTN4Jgfzf/5YCK4/TZ eIGDQFvQ1bHucEAKAxQx+UbUAOJdoJ1/tEo+xjpMD2gwMssdupzzoeVkLUZJutSl+sBe nh5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=I2hS3oSb; 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=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15-20020a170902d48f00b00186892f9f29si13026649plg.488.2022.12.04.02.32.24; Sun, 04 Dec 2022 02:32:36 -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=@quicinc.com header.s=qcppdkim1 header.b=I2hS3oSb; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229934AbiLDJXn (ORCPT + 82 others); Sun, 4 Dec 2022 04:23:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbiLDJXi (ORCPT ); Sun, 4 Dec 2022 04:23:38 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D51016580; Sun, 4 Dec 2022 01:23:37 -0800 (PST) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B49Jb9a016480; Sun, 4 Dec 2022 09:23:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=wnv+eALC//9uYoKqfbEwGHq0ODkglh3YfZ+e98rMwq8=; b=I2hS3oSbE38opmZZILkujUsh1g0xHtZNXxwqvqB2Pn/tIG8YH1Em1DtpPdfGAYpPVkOJ ediEk2yRZ5o4vazay8w93ee65nfU9EuGxP2+Jjjt7zgUKEzbNCKNU4/TNOReWX5xtiJ6 uGdiSsYWjpkT/g9qfSED7U3cGeM3Wo7GXu3DR2Psl+6GGL2lWtTMelivUJ1BBCiuE/lg +u/Mm1ABcvscHC3dMqo/5wXZsYkJvQi9BLEdt5PC0AFihDww8kakUxvyde0aw7/fudtH vgjYw2uCq7WbjGWLJjIvGw44cBtIuRt56KcQekbVKXJ4/5eK0mQk7njpASd8qLIJv9eP ZA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m7wdxswaw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 04 Dec 2022 09:23:34 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2B49NVBc008193 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 4 Dec 2022 09:23:31 GMT Received: from jprakash-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sun, 4 Dec 2022 01:23:27 -0800 From: Jishnu Prakash To: , , , , , , , , , , CC: , , Jishnu Prakash Subject: [PATCH] spmi: Add check for remove callback in spmi_drv_remove API Date: Sun, 4 Dec 2022 14:53:00 +0530 Message-ID: <1670145780-13111-2-git-send-email-quic_jprakash@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1670145780-13111-1-git-send-email-quic_jprakash@quicinc.com> References: <1670145780-13111-1-git-send-email-quic_jprakash@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: -F2_Jhz04IL-8gvOGyiHMgVpjPYQ--st X-Proofpoint-ORIG-GUID: -F2_Jhz04IL-8gvOGyiHMgVpjPYQ--st X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-04_05,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 clxscore=1015 adultscore=0 mlxscore=0 phishscore=0 spamscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=771 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212040087 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 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); -- 2.7.4