Unverified Commit df3ef89d authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

Merge tag 'scmi-fixes-7.0' of...

Merge tag 'scmi-fixes-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into arm/fixes

Arm SCMI fixes for v7.0

Few fixes to:
1. Address a NULL dereference in the SCMI notify error path by ensurin
   __scmi_event_handler_get_ops() consistently returns an ERR_PTR on
   failure, as expected by callers.
2. Fix a device_node reference leak in the SCPI probe path by introducing
   scope-based cleanup for acquired DT nodes.
3. Correct minor spelling errors.

* tag 'scmi-fixes-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux

:
  firmware: arm_scmi: Spelling s/mulit/multi/, s/currenly/currently/
  firmware: arm_scmi: Fix NULL dereference on notify error path
  firmware: arm_scpi: Fix device_node reference leak in probe path

Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents dfc80d65 4e701b47
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1066,7 +1066,7 @@ static int scmi_register_event_handler(struct scmi_notify_instance *ni,
 * since at creation time we usually want to have all setup and ready before
 * events really start flowing.
 *
 * Return: A properly refcounted handler on Success, NULL on Failure
 * Return: A properly refcounted handler on Success, ERR_PTR on Failure
 */
static inline struct scmi_event_handler *
__scmi_event_handler_get_ops(struct scmi_notify_instance *ni,
@@ -1113,7 +1113,7 @@ __scmi_event_handler_get_ops(struct scmi_notify_instance *ni,
	}
	mutex_unlock(&ni->pending_mtx);

	return hndl;
	return hndl ?: ERR_PTR(-ENODEV);
}

static struct scmi_event_handler *
+2 −2
Original line number Diff line number Diff line
@@ -189,13 +189,13 @@ struct scmi_protocol_handle {

/**
 * struct scmi_iterator_state  - Iterator current state descriptor
 * @desc_index: Starting index for the current mulit-part request.
 * @desc_index: Starting index for the current multi-part request.
 * @num_returned: Number of returned items in the last multi-part reply.
 * @num_remaining: Number of remaining items in the multi-part message.
 * @max_resources: Maximum acceptable number of items, configured by the caller
 *		   depending on the underlying resources that it is querying.
 * @loop_idx: The iterator loop index in the current multi-part reply.
 * @rx_len: Size in bytes of the currenly processed message; it can be used by
 * @rx_len: Size in bytes of the currently processed message; it can be used by
 *	    the user of the iterator to verify a reply size.
 * @priv: Optional pointer to some additional state-related private data setup
 *	  by the caller during the iterations.
+3 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include <linux/bitmap.h>
#include <linux/bitfield.h>
#include <linux/cleanup.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/export.h>
@@ -940,13 +941,13 @@ static int scpi_probe(struct platform_device *pdev)
		int idx = scpi_drvinfo->num_chans;
		struct scpi_chan *pchan = scpi_drvinfo->channels + idx;
		struct mbox_client *cl = &pchan->cl;
		struct device_node *shmem = of_parse_phandle(np, "shmem", idx);
		struct device_node *shmem __free(device_node) =
			of_parse_phandle(np, "shmem", idx);

		if (!of_match_node(shmem_of_match, shmem))
			return -ENXIO;

		ret = of_address_to_resource(shmem, 0, &res);
		of_node_put(shmem);
		if (ret) {
			dev_err(dev, "failed to get SCPI payload mem resource\n");
			return ret;