Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4379168rdh; Tue, 28 Nov 2023 22:39:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhRkaFPMjiPt9I7AGJO5w2JNcMSQ3RQFV97TsG+gCtbx6dBa1t6co1WJmisRHeUFTIa+jS X-Received: by 2002:a17:902:f805:b0:1cf:ad71:6f64 with SMTP id ix5-20020a170902f80500b001cfad716f64mr11892778plb.59.1701239946667; Tue, 28 Nov 2023 22:39:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701239946; cv=none; d=google.com; s=arc-20160816; b=YUiM/XVYcCQZDiY2ufbCh69iNiQ7/dL3gO5ZhusOtktA9BhoeAq0Z6MKXoQXLyBYKR U5C7v0AIcaqBXxWhqMP+1gWJF2faZCK3U7z3S9hgGhgMl/cEutZutd7XpJegJ7mFYnDz i8C5hVPden2kZi+JWKG/jEbwpJS8ks1v3ixylwT8EK4CWZaSsqe7y1LFENGK5bQmgjpk m7WWpoDnl2TzWKCc3xNeY/3YhkGUD7cEP9uljR+43IHZcbK2+y+gdx6LTpOJoqDN1Js8 ae2NNN/TrYOXc73XrM0zJwOQ52XoSoYtCmxMn5BMpQSsfdEugJZYKEjWvLFb3bWl5pLA TJjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=GG6HhlQP9nDGltk5ZuJY29M8VLSt3lTWUXWJisYqeaw=; fh=mS/fA5OWhI9kfY5KjSXlcS4ClhztKTruVCL/WwmGL/4=; b=bZ8cNJO2DgI7Gnox7AwbPlnw3ncNcQhsgoQQlh6bOHu0tKp7ju3b700jrttjfhSUv7 P7HpKH7guU7BF0cH9b7eUY577ZZrvTrWwVR7S0u6dHgcWuZJpyCPwJ3SdJcAIge86QcI EOvWlqMuBJFkGXsvCvCgEbC0GOTJKmkeRY0PAz7LmyoPbuk9bn2nOYSkrxViZsJdtVeD JYy4bA0G05X7WYMy4CJt2gus8fhmQA71kXSyekNb7zZKh5RRnlA1wIRZQFTbM5d4BnII qlVq83HJWH4a6HkhwnxJHbj4kLB2HTvBgsiexQFNUW6MNSrT3WYklNiTmV9+zu8/VSwn n8KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=clQb5MA1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id m4-20020a170902bb8400b001d006ff30a4si1950486pls.322.2023.11.28.22.39.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 22:39:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=clQb5MA1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E6CDE80A3091; Tue, 28 Nov 2023 22:39:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230314AbjK2Gip (ORCPT + 99 others); Wed, 29 Nov 2023 01:38:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229563AbjK2Gio (ORCPT ); Wed, 29 Nov 2023 01:38:44 -0500 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 52315170B; Tue, 28 Nov 2023 22:38:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=GG6HhlQP9nDGltk5Zu JY29M8VLSt3lTWUXWJisYqeaw=; b=clQb5MA1av1RwF+U/rELPz3wRAyob3DRP2 xoUjrByk+x+nNcHZQQCwy5EqRQEGFCLQH8LCF9fQ4bOnXGcs9zFGzzFTUtvYV7+0 QxC8uk/dogawbJ6qPlQ/R4rlXOcyt9JgalrVITsz1aTZqTpXpeVG6x/pKoCzv4DC eEBeabQ3s= Received: from localhost.localdomain (unknown [39.144.190.126]) by zwqz-smtp-mta-g3-3 (Coremail) with SMTP id _____wDXDZMs3GZlqeoVCw--.42552S2; Wed, 29 Nov 2023 14:37:34 +0800 (CST) From: Haoran Liu To: ysato@users.sourceforge.jp Cc: dalias@libc.org, glaubitz@physik.fu-berlin.de, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, Haoran Liu Subject: [PATCH] [sh/highlander] psw: Add error handling in psw_irq_handler Date: Tue, 28 Nov 2023 22:37:30 -0800 Message-Id: <20231129063730.31184-1-liuhaoran14@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: _____wDXDZMs3GZlqeoVCw--.42552S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7XFyruF4fZFWrJF1DWF4rXwb_yoWDXrg_Xa s3Zws7Cw1fAwsIvF1akF9xG34fA3s7XFyYqa48Xr12yrWUKrnYqas7tr4kJr48Wr4jyrW7 Jryku39Fy3ya9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sR_VWl3UUUUU== X-Originating-IP: [39.144.190.126] X-CM-SenderInfo: xolxxtxrud0iqu6rljoofrz/xtbBcgU3gletj4wvsgAAsm X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 28 Nov 2023 22:39:04 -0800 (PST) This patch adds error handling for the platform_get_drvdata call within the psw_irq_handler function in arch/sh/boards/mach-highlander/psw.c. Previously, the absence of error checking could lead to unexpected behavior if platform_get_drvdata returned a null pointer. Signed-off-by: Haoran Liu --- arch/sh/boards/mach-highlander/psw.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/sh/boards/mach-highlander/psw.c b/arch/sh/boards/mach-highlander/psw.c index d445c54f74e4..e079215e50e3 100644 --- a/arch/sh/boards/mach-highlander/psw.c +++ b/arch/sh/boards/mach-highlander/psw.c @@ -21,6 +21,12 @@ static irqreturn_t psw_irq_handler(int irq, void *arg) unsigned int l, mask; int ret = 0; + if (!psw) { + pr_err("psw_irq_handler: No push_switch data associated + with platform_device\n"); + return IRQ_NONE; + } + l = __raw_readw(PA_DBSW); /* Nothing to do if there's no state change */ -- 2.17.1