From patchwork Fri Nov 22 22:15:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3648 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3B41141586 for ; Fri, 22 Nov 2024 23:16:59 +0100 (CET) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5cfc0004fabsf2555226a12.1 for ; Fri, 22 Nov 2024 14:16:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1732313819; cv=pass; d=google.com; s=arc-20240605; b=Oyf9vUInWauq/Jf52aYkN8N8UAGBNjs8c4+hsL9sd6UJaGWYh5JbXPdD1hHyvWoNYW AZ7RMnQt4cruagn/o1ExxfwCR7Vy1h0oGmsT123pQpMJf4PSshfCf/6PkM3RA9VBK88R Yb+8uDVgoA0TNh9KR38sNsbzgEO6iADxf2Hjsm3yl0FXlbVsbqA32K2+h3gVIzUbraEK qKLSHdWJTY84gNshtmNXCY41EZn+c1xYK1Ab3rZwX3G1N8CSbFM4hIbPPkmeIK1+meLt 7Hholv2WiS3xOWGxxnv/oAmraRhGOgc6+JUvmAAKa/2Mst2siO+VoiGklNlgWAZZ9W5+ j2Pw== 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=rN0Yhovh49ICggWgeGtOLD0eeGg8d34HNIlbzoqKjU4=; fh=oosbCc9O4FIAMHiKRXw+FUNuOSr/rT/EH3dJRtDpD2c=; b=DJCb1HAReVc11M7CbWq5v4DxsDXE9Bo2IdvfHJJgInHH5VFnCdHflZsg1Iw1/9W8jQ LpCmvOihhGZaYaTOM7fNK8Sfu1iGTEOquFrayYqu7bdb31f0j3DJHgABvRCWcFnvnVe9 QTpuVhHwg6BhEiz9+q/B/vGgfmhN9FH6QkV/u5ofwt1I6iM6/UNLIKI8MyDcIYHqd2nH qdior8STUc8LN31KLl9OTiJmA/vouR92SbbEFEyZG0WcMe12xx7isR43wPM/FFh7uU6X 3mdjCdpJx2QhzMcFm/agOQ87/qX/f46hlPNCAsF7a817E0yiCzfnhdECrItWBlQuXIKH X+9w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=PzD7U1lg; 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=1732313819; x=1732918619; 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=rN0Yhovh49ICggWgeGtOLD0eeGg8d34HNIlbzoqKjU4=; b=dUUSbODLZg3FgQY+i6z3iIClke9DURvKk4EGzd6ez3NCp+w0lhNuS+1yYNVQi6cnkb b7n9Z69dYtGZqd8Rc99oj0i12BHZ+c+9G3Ci+G5MekLn5Vox3mFHlTHCSyUjoWRLaui6 LBN4adO1iIu2oziwKM1M3uQMTG0xv4+Fuk7SE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732313819; x=1732918619; 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=rN0Yhovh49ICggWgeGtOLD0eeGg8d34HNIlbzoqKjU4=; b=OVO/la5Vj9fVS7lXlVHTKeKNbdc5dfbfZDJ5LxxdlklwRbDgtNamiFeS/8ellb5ha+ 2yHQuRrWDhW+uzI7bp4mBxDak01RM7DXtt88E9L6JUvDJKZHQXgm0Q/k6kYD68W/wgWu KSgoNip9g/Vv5Bt6hH1/GP0ZOqCsfAC5OrLUNsYf5VnaMIHNPvYtbxqMGWbmoqORNhl8 uaoqJQRupUlCNRp0dR5/Ds3fSzkP5SRLcF62g9WzeC7MKgpH1CY0zgNSwx2X4Wq46Rdu qChQc34KJoj1SsL26+QgRHw7cuO0TXN5KD6Fc4zw5cZqniX2p/Py5vwIKGwiRZW7kMRQ nXaA== X-Forwarded-Encrypted: i=2; AJvYcCWCrs64Pd1YfUWbKPcJSXLysBh1OLUNTc8639WSQq+v5wGBj6NQwx4GeRgbDFi2/WdTiPnSmzZCHxqBbV5a@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Ywx5LF7qylTUTfmbqdhYyZHcC1rqqPkDky46cvTzBqR3nz9WBrs VscKfJd02o22+rsgSaaLtTwSgcNuk/2cZWLOnQIo4viS0O3GE6MIgAXWu1GT2VrKwA== X-Google-Smtp-Source: AGHT+IHTEy+SX4C1dYclfIX8aoIbvUxdVq6w5pyWrL/9ghMEhME+M3YJIx8ujo3INnFcw4w/83aPcg== X-Received: by 2002:a05:6402:2548:b0:5cf:74c0:b4af with SMTP id 4fb4d7f45d1cf-5d007ca45fcmr9615234a12.13.1732313818871; Fri, 22 Nov 2024 14:16:58 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:d48b:0:b0:5c9:5b3:ee81 with SMTP id 4fb4d7f45d1cf-5d007e5500els582069a12.2.-pod-prod-00-eu; Fri, 22 Nov 2024 14:16:57 -0800 (PST) X-Received: by 2002:a17:906:1daa:b0:aa4:957b:25 with SMTP id a640c23a62f3a-aa509d07146mr506368266b.22.1732313817142; Fri, 22 Nov 2024 14:16:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732313817; cv=none; d=google.com; s=arc-20240605; b=Y3lqHAE8mGP57STIXOWmmJjREzUWAsdCKdsrl2nyjEuqgoYLfY6yMF+w7BdpSdOerT cbJUCqQauG30Y//KuZ5JF5PkJtzkPCto1seBqx3mCESDw1H/zug2EYNCdqmK0vt4sUG8 18++/XTN0Q8Kj2gNiw+/SBzWs2tGqsVQOn6YmokEy5dLPR87KinkkqBTeWbJZiszOCD6 k+UEceT7R2Cs5x1MxHW77uGWW6NDeEoK5dJkB5M9yehvbsQJp337YTiNQFn4PMQ1z2/k iVT8mItl9CBNTPU+zP++cSuZp4+YuA+JcxZRC4PctZubncgzro2i/k7vGvv8xtNysqkG ZnPQ== 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=6HrdX116se3rn9QRZsQ51ceQKyywuhiVyeVP2xiWD4c=; fh=/4mtQbNQtOE6CKCtX2glb6X+KMMzJuj6HH/pLudJy9E=; b=CysW/07t6LoT9NVVVvGTiTVvHP/X6nAs5RYGtDCn6FmIBmdwXzTG3ATdQBTbK+pLZa nDWR0+UT/a4owxyT5VSe4qd5EQBxgP+aF7+rGvDni6gawMNnbkY3BfofSaJNNwjUc3Ok nz9QMP/Pd7M7JQGTm6CS57BZkG187xsQOh/h/mUtACtg5JLDEo0neTdQueXQfEuZ3SbE aLV9ngX0gwLzavAH7faLaraAexedk0jMxdx9dZhRkwKwVwqeWNDrU1ypKCkcnP6bVc+i M/aDCfSsVVyy9S6xBJ9RNNLpyca5LI9/sR+f37rsxi7M/UfoQKu+aAdOnt4sZO9qSqo3 rqRg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=PzD7U1lg; 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-aa50a5ff889sor121410866b.1.2024.11.22.14.16.57 for (Google Transport Security); Fri, 22 Nov 2024 14:16:57 -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: ASbGncu7avTcQk3b2keIR6byX1MCrO2SXbJyfVVJisFttmIsRRB7BEM2aOCrkgx2Jkz nuyEZFc82ML/Ro8kk6FjYZ4zpeGemO0Yu+xZy+1BE0zObI009+XJHRs+QAm33cK0d78BHXfGXj8 FGT02h1rMBfMT/QSHqE7S5D+bXESEjlnPUlplwvbePZFzH6JCivia45b2Ia9GtDCv4hU5W0T7M7 I4JnaYOUHAnMwt06PgoV9NmRShJoGqmKsgD0kV1ru++JfIGMzLRgKaWemnIiscGgiEiRkr2yNMj dZHwvYgcyn7g4NFbXHxA5bmXg8mn7fqhQ21ApOCUNCEcLD28fa7gJKanrcPJcMPtRgefHdreJ2r dhwj83pKfC7WnLsbl X-Received: by 2002:a17:906:31c1:b0:aa5:24df:ca8 with SMTP id a640c23a62f3a-aa524df1311mr297959966b.18.1732313816670; Fri, 22 Nov 2024 14:16:56 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:16:56 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Chen-Yu Tsai , Gerhard Bertelsmann , Jernej Skrabec , Marc Kleine-Budde , Maxime Ripard , Samuel Holland , Vincent Mailhol , linux-arm-kernel@lists.infradead.org, linux-can@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 02/12] can: sun4i_can: call can_change_state() even if cf is NULL Date: Fri, 22 Nov 2024 23:15:43 +0100 Message-ID: <20241122221650.633981-3-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=PzD7U1lg; 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: , The function can_change_state() can also be called if the allocation of the skb fails, as it handles the cf parameter when it is null. Additionally, this ensures that the statistics related to state error counters (i. e. warning, passive, and bus-off) are updated. Fixes: 0738eff14d81 ("can: Allwinner A10/A20 CAN Controller support - Kernel module") Signed-off-by: Dario Binacchi --- Changes in v2: - Added in v2 drivers/net/can/sun4i_can.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 360158c295d3..17f94cca93fb 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -629,10 +629,10 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) tx_state = txerr >= rxerr ? state : 0; rx_state = txerr <= rxerr ? state : 0; - if (likely(skb)) - can_change_state(dev, cf, tx_state, rx_state); - else - priv->can.state = state; + /* The skb allocation might fail, but can_change_state() + * handles cf == NULL. + */ + can_change_state(dev, cf, tx_state, rx_state); if (state == CAN_STATE_BUS_OFF) can_bus_off(dev); }