Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp77639rdb; Sat, 16 Dec 2023 00:18:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IH46/9IqE9lrKvV/nNullqcWD2SLoH2lwtyHNAkOlgPyzxkWmKCL/2e1Bss7tfp/puOLCNs X-Received: by 2002:a50:ed16:0:b0:54c:4fec:116 with SMTP id j22-20020a50ed16000000b0054c4fec0116mr3427260eds.165.1702714713229; Sat, 16 Dec 2023 00:18:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702714713; cv=none; d=google.com; s=arc-20160816; b=UIZoloiECfCREk4PdqzX74A5dHllYP4GpsbNzS2o0g0jFvvH0opROqrtyVro5eN76P l5/JYbx/cA+IiRFKkCtMSwYv4s1W0k7ixcjRV02bsVg6Ui7SaJMVwm/gnQNHblplmfk6 g9C8utN2NJEMdO5seO6nbXBmmiAa/uPyIOlOuhDm6JFvxRpuCeTSIBN/8eG7goFJzLF1 oLwrD1OAvbt5F/WACL1AA8Dyj8Qi47P0K4WMFH91Fj8f72yMfJ+klcQH1+Uc7gkICwjV u6DVvzEuReIMtopxYtK6bPsVQAnS7/eXp1p6R0bTkwGODruWAMNs9Lc2KXitI0ujSl1m 5b8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=UrutHSPGcLDRLLUpSzQn97qPAwY9DBQLxCjQ9z93DWs=; fh=4yp2QyxtUDuRLobHpAHox++i6r+MX3iGxsiXQq2Bm28=; b=0/EcwuLFX09U2oDAee1WUvXYVrDB/GYepUl1oMmjhSzyj4xJ9amcZP4Huaq2BcDaa6 YgAIH1yfMR0fYsqglaCUr60NzbxnHHExhPAiMPHz1NejZ4riy2p0ue5PgTzZuQy+xlRn tutMQy0BeEYKDTyTb6nHHeKq1ofpVcNTJaoxT41Gu268tg6Hy94uf6ky15BMEP2mOLSc nz7FjkeJCY66q9/Sg59UQaMlGxvJqWFVKbhAhF3JHnJieG3HzbfVWjkUd6SJ80Tgiwn1 /PNVCEC3aKQtI1wtM0XU1FwZoYxKCfBzchGZljKMVbsk8umlX4G7hgeyTUGxbLnviLmr HIrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=P2mcD+70; spf=pass (google.com: domain of linux-kernel+bounces-2140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a7-20020a50c307000000b00552fe507f3esi369323edb.659.2023.12.16.00.18.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 00:18:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=P2mcD+70; spf=pass (google.com: domain of linux-kernel+bounces-2140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5C1DE1F255E4 for ; Sat, 16 Dec 2023 08:18:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F370614285; Sat, 16 Dec 2023 08:18:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="P2mcD+70" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87EAA13AED; Sat, 16 Dec 2023 08:18:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BG8AlnW011556; Sat, 16 Dec 2023 08:15:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=UrutHSPGcLDRLLUpSzQn97qPAwY9DBQLxCjQ9z93DWs=; b=P2 mcD+70T0TpAXVrwTaecPrUvY+EWWkwBu4MIT0j4DciDLrbngCVypQxXrEz8EW1Ev Fol2HOa2iQp54LLF3T8GXZHMqUBXdzSIUt/bn56b1z/WJpEB582DL2VntRr5KzT0 Qv2djQvJ7mqROMv7lIkNXx1urqlqug0xttGL4ks+KAXN2CEirAVKPHHuV4RIfgrG /y0VisQtm1ara5PT+tcR4Lmj/8ChbSY+zXy5/JpLZyh8XEYEsN4Hhi9Gct2DCSVY iZ7tOlEHVGSv7YDFN9WVz3Php6Ury7U1ZIGjfuueaJakfV1GfPyM9Wyjc82N/j0T X2S8QUAY2kICJHHPJZGw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v14vjg7vw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 16 Dec 2023 08:15:22 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BG8FLdL011863 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 16 Dec 2023 08:15:21 GMT Received: from [10.216.47.123] (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Sat, 16 Dec 2023 00:15:17 -0800 Message-ID: <89ca6eb2-9a33-c37e-14ae-6181edb8626c@quicinc.com> Date: Sat, 16 Dec 2023 13:45:14 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] power: reset: msm: Process register_restart_handler() error Content-Language: en-US To: Nikita Kiryushin , Andy Gross CC: Bjorn Andersson , Konrad Dybcio , Sebastian Reichel , Stephen Boyd , Pramod Gurav , Guenter Roeck , , , , References: From: Mukesh Ojha In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: iPeTEqpyHD1CYQFA_s5Qs3YqJqvzId4w X-Proofpoint-GUID: iPeTEqpyHD1CYQFA_s5Qs3YqJqvzId4w X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 bulkscore=0 clxscore=1011 malwarescore=0 lowpriorityscore=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312160062 On 11/8/2023 10:57 PM, Nikita Kiryushin wrote: > If registering restart handler fails for msm-restart result is not checked. > It may be irrelevant now (as stated in comment to register_restart_handler, > the function currently always returns zero), but if the behavior changes > in the future, an error at registration of handler will be silently > skipped. > > Add return error code and print error message too debug log in case of > non-zero result of register_restart_handler. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: 18a702e0de98 ("power: reset: use restart_notifier mechanism for > msm-poweroff") > > Signed-off-by: Nikita Kiryushin > --- >  drivers/power/reset/msm-poweroff.c | 7 ++++++- >  1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/power/reset/msm-poweroff.c > b/drivers/power/reset/msm-poweroff.c > index b9a401bd280b..5877a1ba2778 100644 > --- a/drivers/power/reset/msm-poweroff.c > +++ b/drivers/power/reset/msm-poweroff.c > @@ -35,11 +35,16 @@ static void do_msm_poweroff(void) >   static int msm_restart_probe(struct platform_device *pdev) >  { > +    int ret = -EINVAL; This does not add up anything., no need to initialize. -Mukesh >      msm_ps_hold = devm_platform_ioremap_resource(pdev, 0); >      if (IS_ERR(msm_ps_hold)) >          return PTR_ERR(msm_ps_hold); >  -    register_restart_handler(&restart_nb); > +    ret = register_restart_handler(&restart_nb); > +    if (ret) { > +        dev_err(&pdev->dev, "unable to register restart handler, %d\n", > ret); > +        return ret; > +    } >       pm_power_off = do_msm_poweroff; >  -- 2.34.1 >