From nobody Tue Oct 28 01:56:37 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516108690305614.1452801986939; Tue, 16 Jan 2018 05:18:10 -0800 (PST) Received: from localhost ([::1]:35713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebR7t-0003yz-IZ for importer@patchew.org; Tue, 16 Jan 2018 08:18:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebR6A-00039t-GY for qemu-devel@nongnu.org; Tue, 16 Jan 2018 08:16:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebR68-0006uZ-IV for qemu-devel@nongnu.org; Tue, 16 Jan 2018 08:16:18 -0500 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:41462) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebR68-0006tj-EW for qemu-devel@nongnu.org; Tue, 16 Jan 2018 08:16:16 -0500 Received: by mail-qt0-x244.google.com with SMTP id i1so1288787qtj.8 for ; Tue, 16 Jan 2018 05:16:16 -0800 (PST) Received: from x1.local ([138.117.48.219]) by smtp.gmail.com with ESMTPSA id k29sm1436180qtc.87.2018.01.16.05.16.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 05:16:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BKNcK+km0xVNNUKeutf/BCAPWPsrJ+7UdqFQ/AASSns=; b=H+AgjBXdAxkVrIx3D+lAyLFQOlncFLdp5fewLo8DKxxz4jAsEF8/XWFWWEcn9f99DK wppQCHf8LKYUJHjMfNeLXkzgj8cCK/t0j8iQkSFFv0huBqA0tMOpc0PmQCtIi6tIXeWu ivcijFuf6Y4vqwbU8+n8AVcmg6Ibx/2R3Lad+sxHyO8pgrnB1LnPYf5oy7mpMHxBt3rw M22OEBdjwOg4ixol/St2UYPeJUDcpoOgYi4pL5yEv4eStp/oo7xuDyQ9MEmGpMrfEV62 DEAy7D0kXLVkmkiGPY36DEEbsIjRmmZW0KC87S42EE04Rc16+vVokWvyNsYyn5KD0dI/ nKOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BKNcK+km0xVNNUKeutf/BCAPWPsrJ+7UdqFQ/AASSns=; b=N43CnfR/0AqbHL0PUp9C7h5wmqb1kekYchP/kTNbQ4bWb/j4z8+XTdemMv59Ova5Ju aqBnS51idw/Zj/nlO9gSejd2R3JPnHizA259G1PoZ5ZxE+J8sCNXYIpX8pGtzaadY6gA zHd92D+nbkHBSR+EBVLAMtdEZcIMmR68yjNPbSke3Es2o8GTkA5A6QqUR6fJpff7UkVN APTAV4So2Hd75TRAzwwO33198o2rHJv61HHU2vhpezKxl3Giy4Y6N27X+neXGrLogice yy4PPVAY9M8ndKgbl/5SLFGF1d/ULzP4NT0Boy7GJtWQOx+hItBjiUSXxrSTKRBWsekv +TwQ== X-Gm-Message-State: AKwxytcbHHEa/yh/4BuQL47/AfmzbcM7SXWCQaPT0WmGDnM/QTifKi+9 DbByXGKtLAiuFWzrRwa0msI= X-Google-Smtp-Source: ACJfBovziHz5ws/fAUug6EYd+la1iQcWhq6TCbUdn3GifWyC30RIQO64VLAhMNcEoTyHLmLIyFG9XQ== X-Received: by 10.237.63.252 with SMTP id w57mr23684376qth.251.1516108575951; Tue, 16 Jan 2018 05:16:15 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Eduardo Habkost , Markus Armbruster , Peter Maydell , Paolo Bonzini , Eric Blake , Marcel Apfelbaum Date: Tue, 16 Jan 2018 10:15:45 -0300 Message-Id: <20180116131555.14242-2-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180116131555.14242-1-f4bug@amsat.org> References: <20180116131555.14242-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::244 Subject: [Qemu-devel] [PATCH 01/11] smbus: add a NULL check for SMBusDeviceClass::init callbacks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 ensure SMBusDeviceClass::init is set before calling it Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eduardo Habkost --- hw/i2c/smbus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/i2c/smbus.c b/hw/i2c/smbus.c index 2d1b79a689..a90d65ef37 100644 --- a/hw/i2c/smbus.c +++ b/hw/i2c/smbus.c @@ -207,7 +207,11 @@ static int smbus_device_init(I2CSlave *i2c) SMBusDevice *dev =3D SMBUS_DEVICE(i2c); SMBusDeviceClass *sc =3D SMBUS_DEVICE_GET_CLASS(dev); =20 - return sc->init(dev); + if (sc->init) { + return sc->init(dev); + } + + return 0; } =20 /* Master device commands. */ --=20 2.15.1