From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A904743D50E for ; Sat, 28 Feb 2026 14:46:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772289999; cv=none; b=JntITUEDIXCgO2mW3GKaDdJTLgjiuLMHCepN93IcRjhsIRc/bg3MXHswJtOGjc5XL/pqmfEf2vNbHc+SWU792vqCc90Ha0VlvCqDDdSc9x6bW+1b1f0m9c1BIr3/y5raUzFDYFNdsdRngXuEq3GxCSDh5YBa3lYBw6e+yLEe4zQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772289999; c=relaxed/simple; bh=ZYyhJQkdtnd8QDPUZ1anLzQIQsKr2hta6/LxIh0+qI4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LRNQdyta6IYeAUeq1LmD3yTE6U17LxzvwSymvBjauLZVTmuGC32jwfWjXzjtzidpHM2yflseSl9Os/IwvUX8pgJvSfR35b8YL9jn/P/2flwUxc2G8RM7UFCs2atyY3d60Y9s1QEI34D/hdInx0upaa5L4DLnemHJyPkuvO96fbE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=FNZCX320; arc=none smtp.client-ip=91.218.175.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="FNZCX320" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772289996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=06tPI1zyP9R/VLmH+jF1xBpu3FdDn3mEhwsITAJzEjQ=; b=FNZCX320OMDjyz3iUL8GutbeMfTYSRZgA8PvnSnXWB6rMM5/3ji+UIEl48mduoz+bzLSUE g1vR4y5QYtCOXmvyATmZ8D0MimCWd+lhwK411A0nGFD3WIyfIBc9wBPj77WUdiBNDluOjS PLOhw+UiALLBapLERrllp//YTDHNfQU= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH 5/7] HID: asus: simplify and improve asus_kbd_set_report() Date: Sat, 28 Feb 2026 15:46:24 +0100 Message-ID: <20260228144626.1661530-6-denis.benato@linux.dev> In-Reply-To: <20260228144626.1661530-1-denis.benato@linux.dev> References: <20260228144626.1661530-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Make the function shorter and easier to read using __free, and also fix a misaligned comment closing tag. The __free macro from cleanup.h is already used in the driver, but its include is missing: add it. Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 48731b48523d..61705fd10d90 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -21,6 +21,7 @@ */ #include +#include #include #include #include @@ -464,23 +465,18 @@ static int asus_raw_event(struct hid_device *hdev, static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t buf_size) { - unsigned char *dmabuf; int ret; - dmabuf = kmemdup(buf, buf_size, GFP_KERNEL); + u8 *dmabuf __free(kfree) = kmemdup(buf, buf_size, GFP_KERNEL); if (!dmabuf) return -ENOMEM; /* * The report ID should be set from the incoming buffer due to LED and key * interfaces having different pages - */ - ret = hid_hw_raw_request(hdev, buf[0], dmabuf, - buf_size, HID_FEATURE_REPORT, - HID_REQ_SET_REPORT); - kfree(dmabuf); - - return ret; + */ + return hid_hw_raw_request(hdev, buf[0], dmabuf, buf_size, HID_FEATURE_REPORT, + HID_REQ_SET_REPORT); } static int asus_kbd_init(struct hid_device *hdev, u8 report_id) -- 2.53.0