lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 30 Oct 2021 19:20:16 +0200
From:   Thomas WeiƟschuh <thomas@...ch.de>
To:     Charles Mirabile <cmirabil@...hat.com>
Cc:     linux-kernel@...r.kernel.org, Lee Jones <lee.jones@...aro.org>,
        Serge Schneider <serge@...pberrypi.org>,
        Stefan Wahren <stefan.wahren@...e.com>,
        Nicolas Saenz Julienne <nsaenzju@...hat.com>,
        linux-rpi-kernel@...ts.infradead.org, fedora-rpi@...glegroups.com,
        Mwesigwa Guma <mguma@...hat.com>,
        Joel Savitz <jsavitz@...hat.com>
Subject: Re: [PATCH 1/5] drivers/mfd: sensehat: Raspberry Pi Sense HAT core
 driver

On 2021-10-29 17:55-0400, Charles Mirabile wrote:
> +static int sensehat_probe(struct i2c_client *i2c,
> +			       const struct i2c_device_id *id)
> +{
> 	...
> +
> +	sensehat->joystick.pdev = sensehat_client_dev_register(sensehat,
> +							       "sensehat-joystick");

Will this not fail the complete driver load if the driver for this single
subdevice is not available?
For example if the Kconfig option has not been selected, the patch for the
driver is not applied or the user has blacklisted the respective module in
their system.

> +	if (IS_ERR(sensehat->joystick.pdev)) {
> +		dev_err(sensehat->dev, "failed to register sensehat-joystick");
> +		return PTR_ERR(sensehat->joystick.pdev);
> +	}
> +
> +	sensehat->display.pdev = sensehat_client_dev_register(sensehat,
> +								  "sensehat-display");

Same as above.

> +
> +	if (IS_ERR(sensehat->display.pdev)) {
> +		dev_err(sensehat->dev, "failed to register sensehat-display");
> +		return PTR_ERR(sensehat->display.pdev);
> +	}
> +
> +	return 0;
> +}
> +
> +static struct platform_device *
> +sensehat_client_dev_register(struct sensehat *sensehat, const char *name)
> +{
> +	long ret = -ENOMEM;
> +	struct platform_device *pdev = platform_device_alloc(name, -1);
> +
> +	if (!pdev)
> +		goto alloc_fail;
> +
> +	pdev->dev.parent = sensehat->dev;
> +	platform_set_drvdata(pdev, sensehat);
> +
> +	ret = platform_device_add(pdev);
> +	if (ret)
> +		goto add_fail;
> +
> +	ret = devm_add_action_or_reset(sensehat->dev,
> +		(void *)platform_device_unregister, pdev);
> +	if (ret)
> +		goto alloc_fail;
> +
> +	return pdev;
> +
> +add_fail:
> +	platform_device_put(pdev);
> +alloc_fail:
> +	return ERR_PTR(ret);
> +}

Thomas

Powered by blists - more mailing lists