From patchwork Fri Nov 22 22:15:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3651 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id AD01741586 for ; Fri, 22 Nov 2024 23:17:02 +0100 (CET) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5cfc0004fabsf2555405a12.1 for ; Fri, 22 Nov 2024 14:17:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1732313822; cv=pass; d=google.com; s=arc-20240605; b=P/O072SH0sIYK9QvWoCp5XXvBq89YvJdpy2ljj7Jb2LzPXwRQgLDIv626bXVCBVxHy H4Ax+SWRNzl6IVn5o3n/JkxcMaOndw6eDkIQQlFrZuSWn8irFfEaeZL7vINpZn7tSC5R GhLs2LWIDglAuXB1Zc6cbNBwo+HosZw4xYOHN3TJ43p+OYXc7RryGAjUjQscFjycgzCy QOWwdjwNIQBKVsjad8jtlBCzQYhwzbSDdR9ncllg5IDq6vgoFL2m2bj8ktcKOmBmh1id r8mTRUqk5NunpBF3UK5TRDzyTG7BrNhOmeWZqbjOLvNCaSg2icvmKUFYFjKtwtVaqt6Z Qxow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=15ri9dRJ2MpNK0NZi/0DqKNcr6ppNHdPG9MEKyT43QM=; fh=LOUe/rXp56c2v1RA1GEsdl7b3Qq1G5eaTWuoZY4HrGU=; b=W4BUbdNoj8E/xTGAIejLKavjDxJP84fiwDrPK4P4GQ70ZOxmascDmwlnu6x3HQC+6F oZqljcKL8DpWRK/pDZJvAIgHBJ9qGT0Mry5iczR2Yk1gLkzhc7D9Lp81xui1gL8vca6J OUpuXv7OZ2IpxRCQrGvoUOFVmv00J03k2CRZP93cg8VP/k+wmDMvjZPGftBIt6riymRF 6weZZ8zIZ7U8EAfXh/Sf/1rYxUBTkJ3UHkNLu2Ms9rPeywXnKAsOOUrGJWs9am9Aoeui s3LoI46fWFDmcwisOcEj7LU73Ota0bMhquLl0JdjB9SxeZupnbvex6kIeWm8RSvbHYgv XZoA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oRGrWnlX; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1732313822; x=1732918622; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=15ri9dRJ2MpNK0NZi/0DqKNcr6ppNHdPG9MEKyT43QM=; b=ML9gG4F1cLsRhIIt5WFsMWJN3wDpsOP2rmcDT18mG6woOVx9gjPCRE+QCHAKG5yzRv HRWRQ8SUU4vhqpFZwV8M1a/JSdMGsCeBJM3Fve4r35m/tTmMgI56E0ICuJ3OlTKAD1E0 nang8oCWyiSF/TIbOC0RhJMYJucal6Rn9rQXs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732313822; x=1732918622; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=15ri9dRJ2MpNK0NZi/0DqKNcr6ppNHdPG9MEKyT43QM=; b=JKLqCy1lFnzCuKYqZuzTWiPmpo/sW6JRSDsB+zydxFQKhr9pdgaPI1G0TtOyDgPRrM 1gMBwvX33h0RKfBIBcCloOhdoBUqtt918UCBzXSFQazkKhKk2871fECNkRUwAUqKHZER EDIM5gCHKIs4xHo29i5O4b8SKmv2V1HrqG7q70sA86rt0tj9UmBUlGI7K8k8JN7wZ++V 7LtP3uVXGEw3R4UPnGDntK0/RYnhG5bQKkq7Xr/HvvritU6ce3YbUxpwm5UH28fwH90H bFo4BxpUdGUhjGtcsAK2QdUkGeVI27A2M2J+sBNgFWSHgyDOqcIOv+9TKHd9JEIb7EPm PnGg== X-Forwarded-Encrypted: i=2; AJvYcCU5XbKk4XiEXvMuDtLOXMYK/qTsJ+8Cr3lEfIq5XvaBdnVUUYe8yG0vm3refMBgrGZZ5sC8ExQIsMFJk3IR@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yw//IqxJ7P58CYAGmc8hXmiXH2LQMcEkTD0ZOc0mqBO1SKWG94m VxtbmPfSyY51eEIdm0NMQHi97/ULHFoGW9zuy3DzddDbVt4s19xYxzOvpFG4Nso7Rv2kj6ZVHQ= = X-Google-Smtp-Source: AGHT+IGttACKmQVKHUS26sofm4zR58DHVPeKsx0VXprqxCoBmpCieakMpvjWqCxW1HQ0S4AEf+oqtQ== X-Received: by 2002:a05:6402:5114:b0:5cf:cec3:d53 with SMTP id 4fb4d7f45d1cf-5d007be49c4mr8995156a12.3.1732313822115; Fri, 22 Nov 2024 14:17:02 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a50:8a93:0:b0:5cf:e16b:7eb2 with SMTP id 4fb4d7f45d1cf-5d007cc5addls471473a12.0.-pod-prod-00-eu; Fri, 22 Nov 2024 14:17:00 -0800 (PST) X-Received: by 2002:a17:907:1c9d:b0:a9e:e1a5:755f with SMTP id a640c23a62f3a-aa4ef9433f3mr818847266b.1.1732313820337; Fri, 22 Nov 2024 14:17:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732313820; cv=none; d=google.com; s=arc-20240605; b=LCpatjfejogvRdUW14v51CtlIeuF2GmBwdk9xVvu7DxdDQHAOBfkjZwtm7dtNVaQyp AcF221GihWZ6e+6Ni+85CPx1nIvvQ1SD/tEi0v9c5Wqhb7gt3WBtFcUPyWMUcZqDPPjF sDdsrzDXmTGS62H4lLOJAO+CQD4MzUHU+blM2AOn5z0ZO56qSYnwW4i36IdfEZav6UmX N7r0a2D3CvdSUMAOfhhGZAl3O9cKfr/yw60qieKcXCSFp+NjTmRp5kr3H2Y7rKyLZGkY vxeK8sGS3GTnFFgkBkicOT7w/EDXSYtrA32QJ2bbAIc7YiYbzDpN0LOJhe6SBAgrtCEg YQ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=WH36KmdYBNGOfsV00pmvqC+HZVSDrTPa9bev2FjcerA=; fh=KPqUMTZ6D0oyaiGhwn0WF7Qj0FpxJTNWmT+VH7msReo=; b=f7KlE9BP1JRiduaupuTZ7pmRMFigU8i9/ZgUrXlXAfKWqKnEigxERRJOMMgf8FGfck bRCUDTgfcNeOCd1n4FMdFc3CCKF7wFqSV4KQbTjHR7BJJPcNPMH4gLqUbFKpwkWjo1cV TGaQ6HFVyWm1CWo+J7EDapvlm6k1BScb1maN42ChOGOTRSswLgEyXIK6WTXSo/mk2VW/ 3cb1a8fZBVjYNK2hIN9MHA5hDIXzUDIJDHzLruocXc2EarKLxrdoARts/7jNSjWI1QbF 0l7yDpmnXQGQ6hpbskZv9S7UdWgNNBUus4vEHHEW9+PuQISoJ403J4SP5R54EJBU7Yjc q5DA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oRGrWnlX; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-aa50a5ff5casor123394366b.2.2024.11.22.14.17.00 for (Google Transport Security); Fri, 22 Nov 2024 14:17:00 -0800 (PST) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Gm-Gg: ASbGncumVqhujCeXA2FLOG00r0vn5ZTusQcczz5vmRgGZmp70bOIQY9pO5Fq2UWddgV Ejjeo9nGV6PXHI6wknBj0akWQq/DSi/3XOxnzelR48a6FVv539z5BSZrTK2u1WD4H6qk1LaEz9J LMtJ0UuvCjueJXWcS6EDgka8gcnH2aqTiHhhS/Ttm4AmyJeKRPojfRV2oqd/3Cfmsu50mAaUTOy Ui7j28s19e7yNSYsK6ijtUKYaR8D33ZborzaTaQiixmT1iNvA9635vbbtvJB0/vVaHv+RylQly1 oguYRygFmMaJpuj5BZIrTl1RrUfEsqwUVbZK0vA80Js/Dhb7I/QyJLNNClHcokYS6VvmtyM+NcC D5mcv0+im++MwDJKp X-Received: by 2002:a17:907:aa8:b0:a91:1699:f8eb with SMTP id a640c23a62f3a-aa509d5aca6mr395581566b.28.1732313819950; Fri, 22 Nov 2024 14:16:59 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-54-94-193.retail.telecomitalia.it. [82.54.94.193]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b52fcebsm148226466b.127.2024.11.22.14.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:16:59 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Krzysztof Kozlowski , Marc Kleine-Budde , Vincent Mailhol , linux-can@vger.kernel.org Subject: [PATCH v2 05/12] can: hi311x: update state error statistics if skb allocation fails Date: Fri, 22 Nov 2024 23:15:46 +0100 Message-ID: <20241122221650.633981-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241122221650.633981-1-dario.binacchi@amarulasolutions.com> References: <20241122221650.633981-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oRGrWnlX; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch ensures that the statistics related to state error counters (i. e. warning, passive, and bus-off) are updated even in case the skb allocation fails. Additionally, the bus-off state is now also handled. Signed-off-by: Dario Binacchi --- Changes in v2: - Added in v2 drivers/net/can/spi/hi311x.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c index b67464df25ff..25d9b32f5701 100644 --- a/drivers/net/can/spi/hi311x.c +++ b/drivers/net/can/spi/hi311x.c @@ -663,8 +663,6 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) u8 rxerr, txerr; skb = alloc_can_err_skb(net, &cf); - if (!skb) - break; txerr = hi3110_read(spi, HI3110_READ_TEC); rxerr = hi3110_read(spi, HI3110_READ_REC); @@ -673,14 +671,15 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) can_change_state(net, cf, tx_state, rx_state); if (new_state == CAN_STATE_BUS_OFF) { - netif_rx(skb); + if (skb) + netif_rx(skb); can_bus_off(net); if (priv->can.restart_ms == 0) { priv->force_quit = 1; hi3110_hw_sleep(spi); break; } - } else { + } else if (skb) { cf->can_id |= CAN_ERR_CNT; cf->data[6] = txerr; cf->data[7] = rxerr;