From patchwork Wed Oct 2 13:39:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1170679 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="FiN89WQN"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46jy2K73pvz9sPx for ; Wed, 2 Oct 2019 23:40:41 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 86767C21E34; Wed, 2 Oct 2019 13:39:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 818E6C21E1B; Wed, 2 Oct 2019 13:39:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CE757C21DD4; Wed, 2 Oct 2019 13:39:41 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by lists.denx.de (Postfix) with ESMTPS id 05329C21C38 for ; Wed, 2 Oct 2019 13:39:40 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id r19so7254033wmh.2 for ; Wed, 02 Oct 2019 06:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=xMCG+jnjHnO4603O3KvnYRNWPEavRE+yb8iz3DLHsEs=; b=FiN89WQNSeaWi9MqEt8sDOqhT/PBTypzprXNIuriZptdUfVjMRztB5pO3Pd60IGrAX 87z2NPwf2AGrfXhE7zBho07T1ULvAkp9wjvOa0R2mpWlS5UXOET7svsZURAYIIKGo+6+ BO3f1lq+ULB32kef3NOnGKtDTUwViVX3iQlL5RKyyxKMD4LpvlYPpW8vk2yB4c2ROZAi hAjXogtMjrxfb/BxyfVasGz8adZcLJZ92VBfl/mSKGpyfh2FJqcmFsZ/SKEBP+yR8wXc WGSliIkmUgj15w5ocfEfnbf8uuTSOp7nin1UD9m9vtof11nThdY1gTocRNQnCSxp0l5C ikHw== 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:in-reply-to:references; bh=xMCG+jnjHnO4603O3KvnYRNWPEavRE+yb8iz3DLHsEs=; b=M4wepXgomvGdR9z7n4HxgIg6Iw2hfIaPY/atTxGXtsyGVMuGHS1UxsRIsN87QJvVWL iRPumfcG6/ifP+SefcIOC+Xuyz3ECuOioNuku8NcT4/UOPxGOrHxvfLjEy3HX6nf8LbT eYfFNrNTbsjG3L2VM2gZER5dlDj63lfpqriXPD3avquOji8hZJeOW/U/2pLAWm/7tF6r Cxr27r/HW6DT2O2LqyTROopXASHtsm2HvKWkzYPOEZx2t1fgIteCheZhhUnTJP2wbYvP wxwtqUXUz3FDZAxBGyxLRkoUEctavgKKiFFxsze5iMYgfaAwuB4VvUYFpYl2BXgQ7FW+ ln1A== X-Gm-Message-State: APjAAAXbh2AqHKl5FR24TMlH6ppB1FWcx3QnCtjQ7epMl/a1i+sroGip e0thEcnKo0+XXPJAxZBbRz8BpKhnzYGu0Q== X-Google-Smtp-Source: APXvYqwF+Mj/XBtkVlGUMMSYUK6y7jdiri2ZzIbnMmbEHMNmNBigN7Mp81lOS0rePHRin/pBmIFaAQ== X-Received: by 2002:a1c:28d4:: with SMTP id o203mr3070331wmo.142.1570023578522; Wed, 02 Oct 2019 06:39:38 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id r7sm20730209wrx.87.2019.10.02.06.39.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Oct 2019 06:39:37 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Date: Wed, 2 Oct 2019 15:39:19 +0200 Message-Id: <02fcc07b50685cc7c4f3184118ced75d26ab5b72.1570023563.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Cc: ibai.erkiaga-elorza@xilinx.com, luca@lucaceresoli.net Subject: [U-Boot] [PATCH v2 01/13] mailbox: check ops prior calling X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Ibai Erkiaga Check if request and free operations are present prior calling to the functions. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- Changes in v2: None drivers/mailbox/mailbox-uclass.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/mailbox-uclass.c b/drivers/mailbox/mailbox-uclass.c index 1b4a5863c9e5..809f26b20258 100644 --- a/drivers/mailbox/mailbox-uclass.c +++ b/drivers/mailbox/mailbox-uclass.c @@ -63,7 +63,8 @@ int mbox_get_by_index(struct udevice *dev, int index, struct mbox_chan *chan) return ret; } - ret = ops->request(chan); + if (ops->request) + ret = ops->request(chan); if (ret) { debug("ops->request() failed: %d\n", ret); return ret; @@ -94,7 +95,10 @@ int mbox_free(struct mbox_chan *chan) debug("%s(chan=%p)\n", __func__, chan); - return ops->free(chan); + if (ops->free) + return ops->free(chan); + + return 0; } int mbox_send(struct mbox_chan *chan, const void *data)